Is it possible to talk to a cometd service when using Backone.sync?
Thanks in advance
EDIT
After some reading it seems you can overwrite the Backbone.sync().
Backbone.sync is the function that Backbone calls every time it attempts to read or save a model to the server. By default, it uses (jQuery/Zepto).ajax to make a RESTful JSON request. You can override it in order to use a different persistence strategy, such as WebSockets, XML transport, or Local Storage.
I can’t find any more information on this though.
Indeed, all you need to do is override
sync.A good example to follow in order to see how it is done is the backbone localstorage storage.
In brief, you define a method that replaces
syncon your models/collections:The
methodargument can be one ofread,create,update,deleteandmodelcan be either a model, or a collection. Essentially you only need to cover the four methods and everything will work like a charm. Bear in mind that while the localstorage example is useful it is also simplistic in some ways, so having a look at Backbone itself never hurts.