I'm using backbone.js with websockets and sending data to the server based on events.
Is it possible to design/rewrite Backbone.sync to transport model changes to the server in a normalized way?
Any general examples of this would be great, then I can figure out how to integrate it with my server-side methods.
Thanks!
I'm using backbone.js with websockets and sending data to the server based on events.
Is it possible to design/rewrite Backbone.sync to transport model changes to the server in a normalized way?
Any general examples of this would be great, then I can figure out how to integrate it with my server-side methods.
Thanks!
Share Improve this question edited Sep 20, 2011 at 0:17 boom asked Sep 19, 2011 at 23:37 boomboom 11.7k9 gold badges47 silver badges66 bronze badges3 Answers
Reset to default 9I would start with the documentation and the annotated source for the Backbone.Sync function.
Then, see how the "local storage" module modifies Backbone.Sync to store locally instead of to the server as an example of overriding behavior.
Perhaps, this Stack Overflow Question will also help.
Backbone.Sync has very little code, and it's mon to re-write it to work the way you need. I would start by reading the annotated code, and then there are several plugins that you can look at for examples of how to rewrite it yourself.
There is module called backbone.io, try npm install backbone.io