diff --git a/lib/net/tcp.browser.js b/lib/net/tcp.browser.js deleted file mode 100644 index fd53046..0000000 --- a/lib/net/tcp.browser.js +++ /dev/null @@ -1 +0,0 @@ -throw new Error("TCP transport is not supported by Browser platform"); diff --git a/lib/net/tcp.js b/lib/net/tcp.js index 4428301..c7713f7 100644 --- a/lib/net/tcp.js +++ b/lib/net/tcp.js @@ -268,7 +268,9 @@ TcpTransport.prototype.listen = function() { client.on("close", function() { delete self._clients[id]; }); - var transport = new self.constructor(self); + var opts = objectAssign({}, self); + delete opts._server; + var transport = new self.constructor(opts); var incoming = true; transport._setupClient(client, incoming); var addr = client.remoteAddress; diff --git a/lib/net/ws.js b/lib/net/ws.js index df5400d..f40271e 100644 --- a/lib/net/ws.js +++ b/lib/net/ws.js @@ -180,7 +180,9 @@ WsTransport.prototype.listen = function(options, callback) { var server = self._server = new WebSocketServer(options, callback); server.on("connection", function(client) { - var transport = new self.constructor(self); + var opts = objectAssign({}, self); + delete opts._server; + var transport = new self.constructor(opts); var incoming = true; transport._setupClient(client, incoming); transport._handleTimeout(); diff --git a/package.json b/package.json index 1b1967d..47f25dc 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "./lib/index.js", "browser": { "./lib/platform.js": "./lib/platform.browser.js", - "./lib/net/tcp.js": "./lib/net/tcp.browser.js", + "./lib/net/tcp.js": false, "./lib/net/ws.js": "./lib/net/ws.browser.js" }, "scripts": {