javascript - sails.io.js - disconnect from "Resourceful PubSub" -
i'm building single page web application, using sails.js in backend, , sails socket.io.js
socket io wrapper connect.
i've got little helper class let me subscribe models:
subscribe(model, next) { io.socket.get('/' + model, function serverresponded (body, jwr) { if (jwr.statuscode == 200) { next(null, body, jwr.headers); } next('the socket server responded bad status code ' + (jwr.statuscode), null, jwr.headers); }); }
so works (i think, not sure how updates pushed me though :s), however, when user changes page in web app, how supposed disconnect "subscription" , not stay connected, since single page?
i see io.socket.disconnect()
not sure how can fit in.
Comments
Post a Comment