I want to make an app that relies in socket.io to offer real-time collaborative editing and I wonder which of these cases is better/faster:
<textarea id="some-id" onkeypress="broadcast()" ... >Type your text here</textarea>
- every time a change is made the client broadcasts the whole input with the volatile flag, so if a message is lost, the next one will replace it.
- every time a change is made the client broadcasts only that change and other clients apply it.
Also, are there any other APIs/frameworks/plugins that I can use rather than socket-io for collaborative document editing?
Thank you.
Let me answer your question a year after you posted this, because you’re probably very impatient by now!
I think you would be better of with sending the change only.
Socket.IO is pretty good for this job: It has great cross-browser compatibility and the overhead is acceptable. If you’re only targeting browsers that support HTML5’s Websocket, you could use a Websocket package for node.js.