Skip to content

Commit

Permalink
ws: disable perMessageDeflate
Browse files Browse the repository at this point in the history
per-message deflate could be useful for some of our messages, and it is
even enabled by default, but it is also a little bit buggy, so we
disable it so we don't end up with 'write after end' errors from the
underlying socket.

This is most certainly a bug in WS.
  • Loading branch information
rmg committed Jul 6, 2015
1 parent 8bf7c4d commit 5ba8ffa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/ws-channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,15 @@ WebsocketChannel.prototype.connect = function(uri, _token) {
this._uri = uri;
this._token = token;

var headers = {'x-mesh-token': token};
var websocket = new Websocket(uri, {headers: headers});
var opts = {
headers: {'x-mesh-token': token},
// TODO: per-message deflate could be useful for some of our messages, and
// it is even enabled by default, but it is also a little bit buggy, so we
// disable it so we don't end up with 'write after end' errors from the
// underlying socket.
perMessageDeflate: false,
};
var websocket = new Websocket(uri, opts);

this._attach(websocket);

Expand Down

0 comments on commit 5ba8ffa

Please sign in to comment.