I'm new to Backbone and I'm trying to build a Backbone app that graphs and maps data in real-time. I implemented a websocket following this example code. The problem is, I would like to use a more extensive data set than the example code, and if I understand the code, it is just creating one model -- a single array of points. I want a collection of models in which each model has latitude, longitude, and amount (just a numerical value).
How do I implement a websocket such that when my backend sends some JSON, my app creates a new model with those attributes? I've read on blogs about this that I need to override Backbone.sync and implement an event aggregator, but the only examples I've seen of this use socket.io. Socket.io is not an option because of the language/framework I'm using on backend. Moreover, eventually I'll be switching out the backend to another language that also isn't supported by socket.io, so I'd like to find a more general way to implement the websocket on the frontend that does not involve a library like socket.io.