scttnlsn / backbone.io

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

Access to standard socket.io functions #26

Closed cooltrooper closed 11 years ago

cooltrooper commented 11 years ago

Is it possible to use standard socket.io events, say for running functions not directly involving backbone. Such as the beginner code shown on the socket.io site

scttnlsn commented 11 years ago

Absolutely. On the server, the call to backboneio.listen returns the Socket.IO object:

var io = backboneio.listen(...);
io.sockets.emit('foo');

Client-side, there's something similar:

var socket = Backbone.io.connect();
socket.on('foo', function() { ... });