Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

support hook on existing websocket server

  • Loading branch information...
commit 27edb83783dcf88bc8a6c2c58c4b9696889236bd 1 parent e1e634f
tomzhou sequoiar authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/server.js
6 lib/server.js
View
@@ -17,7 +17,11 @@ function BinaryServer(options) {
this.clients = {};
this._clientCounter = 0;
- this._server = new ws.Server(options);
+ if (options.server && (options.server instanceof ws.Server))
+ this._server = options.server;
+ else
+ this._server = new ws.Server(options);
+
this._server.on('connection', function(socket){
var clientId = self._clientCounter;
var binaryClient = new BinaryClient(socket, options);
Please sign in to comment.
Something went wrong with that request. Please try again.