scttnlsn / backbone.io

Backbone.js sync via Socket.IO

Home Page:http://scttnlsn.github.io/backbone.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MemoryStore middleware doesn't care about channel

matteosuppo opened this issue · comments

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.

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.