Skip to content

Commit

Permalink
fix: binary data transmission (socketio#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanleo committed Jun 11, 2020
1 parent 51cf563 commit 334acae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var client = require('redis').createClient;
var parser = require('socket.io-parser');
var msgpack = require('notepack.io');
var debug = require('debug')('socket.io-emitter');
var hasBin = require('has-binary2');

/**
* Module exports.
Expand Down Expand Up @@ -123,7 +124,7 @@ Emitter.prototype.of = function(nsp){
Emitter.prototype.emit = function(){
// packet
var args = Array.prototype.slice.call(arguments);
var packet = { type: parser.EVENT, data: args, nsp: this.nsp };
var packet = { type: hasBin(args) ? parser.BINARY_EVENT : parser.EVENT, data: args, nsp: this.nsp };

var opts = {
rooms: this._rooms,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"debug": "~3.1.0",
"has-binary2": "^2.0.0",
"notepack.io": "~2.1.0",
"redis": "2.6.3",
"socket.io-parser": "3.1.2"
Expand Down

0 comments on commit 334acae

Please sign in to comment.