code: function() {
      var self = this;
      // Unfortunately we can't use a connect middleware here since
      // sockjs installs itself prior to all existing listeners
      // (meaning prior to any connect middlewares) so we need to take
      // an approach similar to overshadowListeners in
      // https://github.com/sockjs/sockjs-node/blob/cf820c55af6a9953e16558555a31decea554f70e/src/utils.coffee
      _.each(['request', 'upgrade'], function(event) {
        var httpServer = WebApp.httpServer;
        var oldHttpServerListeners = httpServer.listeners(event).slice(0);
        httpServer.removeAllListeners(event);
  
        // request and upgrade have different arguments passed but
        // we only care about the first one which is always request
        var newListener = function(request /*, moreArguments */) {
          // Store arguments for use within the closure below
          var args = arguments;
  
          // Rewrite /websocket and /websocket/ urls to /sockjs/websocket while
          // preserving query string.
          var parsedUrl = url.parse(request.url);
          if (parsedUrl.pathname === pathPrefix + '/websocket' ||
              parsedUrl.pathname === pathPrefix + '/websocket/') {
            parsedUrl.pathname = self.prefix + '/websocket';
            request.url = url.format(parsedUrl);
          }
          _.each(oldHttpServerListeners, function(oldListener) {
            oldListener.apply(httpServer, args);
          });
        };
        httpServer.addListener(event, newListener);
      });
    }
docs: Redirect /websocket to /sockjs/websocket in order to not expose sockjs to clients that want to use raw websockets