AmpersandJS / ampersand-sync

Provides sync behavior for updating data from ampersand models and collections to the server.
http://ampersandjs.com
MIT License
20 stars 28 forks source link

Add websockets support #63

Closed vicneanschi closed 9 years ago

vicneanschi commented 9 years ago

It would be nice to be able to choose what transport I want to use for sync: websockets or AJAX. There is already something for Backbone https://github.com/noveogroup/backbone.iobind

naugtur commented 9 years ago

Coming from the Unix philosophy, ampersand-sync does one thing (and hopefully pretty well) and websockets should be supported by another tool that does just that (and well).

Other arguments against it include:

So, how would you like to just test backbone.iobind with ampersand models in place of sync? And if there's quirks, I suppose cloning backbone.iobind and adapting+renaming to ampersand-iobind is always an option. Let us know if you do that!

vicneanschi commented 9 years ago

It shouldn't be much different from Ajax implementation. This is just a matter of transport. But it gives you more: the model updates can be pushed from the server to update the client. Looks like sync is responsible for updates in Ampersand architecture. Can transport be separated from sync logic?

naugtur commented 9 years ago

sync is entirely one-way and it doesn't do much except for getting input in multiple different ways and handling configuration needed for xhr. I'm not saying it's not worth it, I'm not saying it's not a good idea. It's just not something that should be included in sync. (if it were, you'd be linking backbone.sync as an example, not backbone.iobind)