Now when the agent receives remote changes, it will queue them and send the plugin a WriteRequest message. The agent will only send this once for each batch of messages (we can change this later if it becomes an issue, but it will complicate the plugin logic a bit as well).
The plugin, upon receiving a WriteRequest message, should respond with a WriteRequestAck when able. Sending the ack message to the agent indicates that it is safe to apply all pending remote operations. So before sending it, the plugin should disallow (ideally queue, but not apply) changes to the buffer from the local user.
The agent will then reply with an ApplyText message that will contain text patches to apply (or no patches at all). Upon receiving this message the plugin can allow local edits to the buffer again.
Now when the agent receives remote changes, it will queue them and send the plugin a
WriteRequest
message. The agent will only send this once for each batch of messages (we can change this later if it becomes an issue, but it will complicate the plugin logic a bit as well).The plugin, upon receiving a
WriteRequest
message, should respond with aWriteRequestAck
when able. Sending the ack message to the agent indicates that it is safe to apply all pending remote operations. So before sending it, the plugin should disallow (ideally queue, but not apply) changes to the buffer from the local user.The agent will then reply with an
ApplyText
message that will contain text patches to apply (or no patches at all). Upon receiving this message the plugin can allow local edits to the buffer again.