Skip to content

Commit

Permalink
Correct 'Make backend streams write objects'
Browse files Browse the repository at this point in the history
  • Loading branch information
avital committed Jun 16, 2016
1 parent c676077 commit 7ae77c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/client/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ Connection.prototype.send = function(message) {
if (this.debug) console.log('SEND', JSON.stringify(message));

this.emit('send', message);
this.socket.send(message);
this.socket.send(JSON.stringify(message));
};


Expand Down
4 changes: 2 additions & 2 deletions lib/stream-socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ StreamSocket.prototype.close = function(reason) {
};
StreamSocket.prototype.send = function(data) {
// Data is an object
this.stream.push(data);
this.stream.push(JSON.parse(data));
};
StreamSocket.prototype.onmessage = util.doNothing;
StreamSocket.prototype.onclose = util.doNothing;
Expand Down Expand Up @@ -56,7 +56,7 @@ ServerStream.prototype._write = function(chunk, encoding, callback) {
var socket = this.socket;
process.nextTick(function() {
if (socket.readyState !== 1) return;
socket.onmessage({data: chunk});
socket.onmessage({data: JSON.stringify(chunk)});
callback();
});
};

0 comments on commit 7ae77c9

Please sign in to comment.