-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support compression #1958
Support compression #1958
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ Client.prototype.setup = function(){ | |
Client.prototype.connect = function(name){ | ||
debug('connecting to namespace %s', name); | ||
if (!this.server.nsps[name]) { | ||
this.packet({ type: parser.ERROR, nsp: name, data : 'Invalid namespace'}); | ||
this.packet({ type: parser.ERROR, nsp: name, data : 'Invalid namespace'}, false, false, true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might want to reconsider this signature later on. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, I also don't like this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a packet should have these options, so that we can make it isomorphic with the client. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can leave this for a different PR @nkzawa |
||
return; | ||
} | ||
var nsp = this.server.of(name); | ||
|
@@ -135,17 +135,18 @@ Client.prototype.close = function(){ | |
* @param {Object} packet object | ||
* @param {Boolean} whether packet is already encoded | ||
* @param {Boolean} whether packet is volatile | ||
* @param {Boolean} whether packet should be compressed | ||
* @api private | ||
*/ | ||
|
||
Client.prototype.packet = function(packet, preEncoded, volatile){ | ||
Client.prototype.packet = function(packet, preEncoded, volatile, compress){ | ||
var self = this; | ||
|
||
// this writes to the actual connection | ||
function writeToEngine(encodedPackets) { | ||
if (volatile && !self.conn.transport.writable) return; | ||
for (var i = 0; i < encodedPackets.length; i++) { | ||
self.conn.write(encodedPackets[i]); | ||
self.conn.write(encodedPackets[i], { compress: compress }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, is this the same signature the WS client would use? I mention this since it'd be nice to maintain parity so that you could technically replace There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, but that's good enough then… |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
"test": "mocha --reporter dot --slow 200ms --bail" | ||
}, | ||
"dependencies": { | ||
"engine.io": "1.5.1", | ||
"engine.io": "Automattic/engine.io", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's point to a specific |
||
"socket.io-parser": "2.2.2", | ||
"socket.io-client": "1.3.2", | ||
"socket.io-adapter": "0.3.1", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful