Using ... #175

codevin opened this Issue Dec 8, 2012 · 0 comments


None yet

1 participant

codevin commented Dec 8, 2012

I am exploring use of directly from a module. This seems to work, and these are instructions if you want to try.

(However, the sessions need to play well with, as given here: This needs some exploration. )

First change app.js (in root of calipso) as follows:

var socket_io=require("");
// within express.boot() function
     if (app) {
          var server=http.createServer(app);  // requires access to http.Server object.
          var io=socket_io.listen(server);
          app.socketIO=io;  // You need to access this object from modules as
          var out = server.listen(port, function () {

And within the module, use this code. I presume this should be in the route handler code (as opposed to init).'connection',  function(socket) {
     socket.emit('news', <<data object>>); // send something to client.
     socket.on('flag', function(data){...} ); // receive something from client.

And you will also need to put in the usual client code in one of the module templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment