Skip to content

Commit ff4cb3e

Browse files
[feat] Move binary detection to the parser (#1103)
1 parent b4c7e49 commit ff4cb3e

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

lib/socket.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ var toArray = require('to-array');
99
var on = require('./on');
1010
var bind = require('component-bind');
1111
var debug = require('debug')('socket.io-client:socket');
12-
var hasBin = require('has-binary');
1312

1413
/**
1514
* Module exports.
@@ -138,9 +137,7 @@ Socket.prototype.emit = function (ev) {
138137
}
139138

140139
var args = toArray(arguments);
141-
var parserType = parser.EVENT; // default
142-
if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary
143-
var packet = { type: parserType, data: args };
140+
var packet = { type: parser.EVENT, data: args };
144141

145142
packet.options = {};
146143
packet.options.compress = !this.flags || false !== this.flags.compress;
@@ -289,9 +286,8 @@ Socket.prototype.ack = function (id) {
289286
var args = toArray(arguments);
290287
debug('sending ack %j', args);
291288

292-
var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK;
293289
self.packet({
294-
type: type,
290+
type: parser.ACK,
295291
id: id,
296292
data: args
297293
});

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@
2121
"component-emitter": "1.2.1",
2222
"debug": "2.6.4",
2323
"engine.io-client": "2.0.2",
24-
"has-binary": "0.1.7",
2524
"has-cors": "1.1.0",
2625
"indexof": "0.0.1",
2726
"object-component": "0.0.3",
2827
"parseuri": "0.0.5",
29-
"socket.io-parser": "2.3.2",
28+
"socket.io-parser": "~3.1.1",
3029
"to-array": "0.1.4"
3130
},
3231
"devDependencies": {

0 commit comments

Comments
 (0)