Transport fixes

This commit is contained in:
Kagami Hiiragi 2015-02-22 13:12:23 +03:00
parent 0f2a21c134
commit cb917c6bda
4 changed files with 7 additions and 4 deletions

View File

@ -1 +0,0 @@
throw new Error("TCP transport is not supported by Browser platform");

View File

@ -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;

View File

@ -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();

View File

@ -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": {