Where is the server code? I would like to create a Python version of it

Is the code of your mini server to be found anywhere in the code? I would like to translate it to python and make it work with Django/websockets. I tried to look a bit, but did find it.

It’s in the website repository, tangled up with the annotation feature. Porting it to Python is not really an option, unless you want to port the whole model and transform modules (and don’t do that). You could set up a very simple Python server that simply relays JSON changes between clients, but it won’t be able to turn those changes into a full representation of the document unless it has access to an implementation of my document model.

Right, I thought relaying would probably be enough. Possibly stopping some packages from going through under specific conditions, but other than that nothing.

The way we have it set up now (pre-prosemirror) is that the python code simply relays the messages around and appoints one of the connected browsers to be the “master brain” to figure out about merging and to decide what goes into the document in what order, etc. . If that browser disconnected, the backend simply appoints another browser to take over as “master brain”, etc. . Would that also be how we should do it when using Prosemirror?

If you are fully aware of the security implications, sure, that would work. You’ll want to have the master peer send a full version of the document to the server now and then, so that it can save it.

The implication being that the master can do malicious changes to the document? Yes, I am aware of that. Given that the server is channeling all the information back and forth, it should have any private information about the other participants, right?

Only when the document is saved would I do some rudimentary checks on whether something odd has happened to it. Those checks would be on the server.

Yes, that’s also how we have it now.

But is this the recommended way of doing it? I will have to change a lot of code anyway, and if there is little need for us to keep custom and odd behavior if there are better ways around.

If you’re open to running a node process on your server, I think things could be saner by having the server be the authority.

Eventually we will probably do that, and we may even switch entirely to node.js on the backend. But just to keep the change as simple as possible, I will go for the above solution, as that is more or less what we are doing already.<

Thanks for the advice!