scttnlsn / backbone.io

Backbone.js sync via Socket.IO
http://scttnlsn.github.io/backbone.io
540 stars 66 forks source link

MemoryStore middleware doesn't care about channel #34

Closed matteosuppo closed 11 years ago

matteosuppo commented 11 years ago

The memorystore middleware save everything in the array models.

If you have two collections with a different channel they will get the same models from the memorystore middleware.

Is it a bug? Is there something I don't get about the channel option?

I changed the way it works for me, if there's a channel saves and retrieves models in the models[channel] array. If there's no channel it saves them in the models['default'] array.

scttnlsn commented 11 years ago

Yeah, the included memory story is really just an example. You would almost always customize the backend to suit your specific needs. Channels only come into play when notifying clients of updates...if you only want to return a subset of your models when a client is reading a list of models then you need to perform some kind of filtering in your backend. It sounds like you're on the right track with the models[channel] approach.