fortune
fortune copied to clipboard
Syncing client with server
Greetings!
Are there any working examples showing how to sync data between server and clients?
Thanks in advance!
Not yet, I will come up with some examples showcasing a few use cases soon enough. For now there's the tests: https://github.com/fortunejs/fortune/blob/master/test/integration/net/ws_client.js
I'm reading both client and server code. Where do I state the time interval between syncs?
There's no time interval, it's not polling. It uses WebSocket, so the server actually sends updates to the client at any time during the connection.
Oh, ok! :+1:
So, that raises the question: every CRUD action by a client will be send to all other clients?
By default, yes. However, the server can modify or omit the change before sending anything to clients via the change
function.
If you have a cluster of servers, it gets a little tricky because then each server has to coordinate changes among each other to reach the right clients. It is possible to do but isn't abstracted by Fortune.js, at least not yet (I think it should take advantage of multiple cores by default).