I’d like to enable collaborative editing for codemirror using y-codemirror and y-websocket with Go server being used as a backend (WebSocket support is provided by gorilla/websocket).
AFAIU it should be possible to enable this functionality without any yjs-specifc code on server side; only an open websocket connection is required. Is it correct?
The client’s code that I have is as simple as
const doc = new Y.Doc(); var provider = new WebsocketProvider(url, room, doc); const text = doc.getText('codemirror'); const binding = new CodemirrorBinding(text, this.editor, provider.awareness);
It works as a charm. At least the shared editing works across multiple clients in a browser.
However, the browser console reports that a client attempts to send numerous requests with binary content to the server, which the server doesn’t now how to interpret. It causes a request failure as a result. It’d like to solve this problem.
First, what are these messages? Are these sync messages? Why are they needed given that a collaborative editing works without them, as far as I can see. Does it mean that the server cannot be agnostic to y-codemirror/y-websocket libraries being used by the client?
What is a reasonable workaround for solving this problem, given that the server is implemented in Go? Several ideas that I have, which I haven’t managed to implement successfully so far:
- Disable sync messages in client’s code. How to do it and what will be the implications?
- Implement a custom logic in the server for handling the sync messages. I tried to rewrite this logic in Go, unsuccessfully so far. Does it make sense in overall?
It’s the most tiresome approach and I’d like to use it if other alternative solutions are infeasible.
I appreciate your help in advance.