7 ms·
I'm looking forward to seeing someone combine Backbone.js with Websocket-based persistence. It's a bit out of scope for DocumentCloud to tackle, but the buildin
by jashkenas 16y ago
I'm looking forward to seeing someone combine Backbone.js with Websocket-based persistence. It's a bit out of scope for DocumentCloud to tackle, but the building blocks are there.
One client makes a change to a model -> changes are synced to the server -> other clients that currently reference that model have its attributes updated -> all the UI that displays the model is automatically re-rendered.
It's not critical for most applications, but is a really nice, nice-to-have for any JS app that displays the same editable data to more than one user at a time. Built-in conflict resolution mechanism for bonus points.
- datapimp 16y agoI started work on this a little while ago, and shared a starter template on https://github.com/datapimp/backbone-express-mongoose-socketio https://github.com/datapimp/backbone-express-mongoose-socket.... I am starting a new job in 2011 where we will be using this template heavily, so expect major updates in the first couple weeks of January.
- nsm 16y agoI'm doing something pretty similar to rumpetroll (it is fully functional rumpetroll now, but we will add more features) using Backbone Model View Collections as my 'Sprites'. The code isn't public yet, but me and a friend have some plans for it. The only thing different is that we've completely dropped use of Backbone.sync, for the sole reason that the method based approach does not fit very cleanly into what we are doing and websockets. So we have one model as a 'dispatcher' instead, to which all models send messages which are transmitted over websockets. All sprites communicate via attribute change events which is a really good use of Backbone. On the server a tiny node.js wrapper uses Redis pub-sub to relay messages out to other clients. The code is 'out there' but private, so if you want to take a peek at it, please contact me directly. Thanks for a great framework.
- jashkenas 16y agoI'd love to take a peek, if you want to mail an invite to jashkenas at gmail. Replacing Backbone.sync is totally legit -- and is indeed what having Backbone.sync in a single place is intended for. There are many good paths to data persistence: REST/CRUD, RPC, aggregated JSON, CouchDB or Mongo, LocalStorage, and so on. Backbone.sync is just the default implementation for the common case. I think that one of the more exciting things about JS development these days, is how open and flexible the patterns still are.