Has anyone used JSON Patch with an authoritative server state?

Has anyone implemented JSON Patch over WebSocket?

It seems like it is just what I need, but there's a twist:

- I need the server to be authoritative
- but users should be able to initiate some changes optimistically (like adding a message to a chat)

What's the best approach here? Do I need to write some a parser of the JSON patch object to see if it's an authorized operation?

Right now I'm thinking that perhaps the patches are sent only one way (server -> client) and the client sends specific request objects to trigger changes e.g. SendMessageRequest

but perhaps there is a more generalized way where the client can send any patch, and the server just checks to see if it's valid?
Was this page helpful?