fe-ninja
fe-ninja

Reputation: 163

Listen for updates - backbone

I'm doing an app using webs-ockets and backbone. Where should I listen to data updates? In views? or in models?

Also I would like to know appropriate place to listen user events.

Upvotes: 0

Views: 71

Answers (1)

Poni
Poni

Reputation: 11317

Backbone events are not (websocket) API events.

You're probably looking for the websocket.onmessage event.
When you got this event, say on a (Backbone) Model, you could trigger() an event on the Model and let all listeners (probably View objects of Backbone) handle it.

Hope that helps in a way.

Upvotes: 2

Related Questions