tasks/websocket.js
function (server) {

      // Retrieve the configured handler.
      if (handler) {
        handler = require(require('path').resolve() + '/' + handler);
      } else {
        console.log('No handler defined for websocket server, not starting websocket.');
        return;
      }

      // Attach websockets server to http server
      var WebSocketServer = require('websocket').server;
      var wsServer = new WebSocketServer({
        httpServer: server
      });

      // Handle requests
      wsServer.on('request', handler);
    }
function (server) {

      // Retrieve the configured handler.
      if (handler) {
        handler = require(require('path').resolve() + '/' + handler);
      } else {
        console.log('No handler defined for websocket server, not starting websocket.');
        return;
      }

      // Attach websockets server to http server
      var WebSocketServer = require('websocket').server;
      var wsServer = new WebSocketServer({
        httpServer: server
      });

      // Handle requests
      wsServer.on('request', handler);
    }
function ( server ) { // Retrieve the configured handler. if ( handler ) { handler = require ( require ( 'path' ) . resolve ( ) + '/' + handler ) ; } else { console . log ( 'No handler defined for websocket server, not starting websocket.' ) ; return ; } // Attach websockets server to http server var WebSocketServer = require ( 'websocket' ) . server ; var wsServer = new WebSocketServer ( { httpServer : server } ) ; // Handle requests wsServer . on ( 'request' , handler ) ; }
Attaches a websocket server to the specified http server.
Attaches a websocket server to the specified http server .