diff --git a/lib/manager.ts b/lib/manager.ts index bace6061d..b4c7f1bfa 100644 --- a/lib/manager.ts +++ b/lib/manager.ts @@ -5,7 +5,6 @@ import * as parser from "socket.io-parser"; import { Decoder, Encoder } from "socket.io-parser"; import { on } from "./on"; import * as bind from "component-bind"; -import * as indexOf from "indexof"; import * as Backoff from "backo2"; const debug = require("debug")("socket.io-client:manager"); @@ -595,7 +594,7 @@ export class Manager extends Emitter { } function onConnecting() { - if (!~indexOf(self.connecting, socket)) { + if (!~self.connecting.indexOf(socket)) { self.connecting.push(socket); } } @@ -610,7 +609,7 @@ export class Manager extends Emitter { * @private */ _destroy(socket) { - const index = indexOf(this.connecting, socket); + const index = this.connecting.indexOf(socket); if (~index) this.connecting.splice(index, 1); if (this.connecting.length) return; diff --git a/lib/socket.ts b/lib/socket.ts index 75c748c86..c79b86152 100644 --- a/lib/socket.ts +++ b/lib/socket.ts @@ -2,7 +2,6 @@ import { Packet, PacketType } from "socket.io-parser"; import * as Emitter from "component-emitter"; import { on } from "./on"; import * as bind from "component-bind"; -import * as hasBin from "has-binary2"; import { Manager } from "./manager"; const debug = require("debug")("socket.io-client:socket"); @@ -132,9 +131,7 @@ export class Socket extends Emitter { args.unshift(ev); const packet: any = { - type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) - ? PacketType.BINARY_EVENT - : PacketType.EVENT, + type: PacketType.EVENT, data: args, }; @@ -282,7 +279,7 @@ export class Socket extends Emitter { debug("sending ack %j", args); self.packet({ - type: hasBin(args) ? PacketType.BINARY_ACK : PacketType.ACK, + type: PacketType.ACK, id: id, data: args, }); @@ -409,16 +406,4 @@ export class Socket extends Emitter { this.flags.compress = compress; return this; } - - /** - * Sets the binary flag - * - * @param {Boolean} binary - whether the emitted data contains binary - * @return {Socket} self - * @public - */ - public binary(binary: boolean): Socket { - this.flags.binary = binary; - return this; - } } diff --git a/package.json b/package.json index ea861dc97..c3e653e3d 100644 --- a/package.json +++ b/package.json @@ -33,10 +33,8 @@ "component-emitter": "~1.3.0", "debug": "~4.1.0", "engine.io-client": "~4.0.0", - "has-binary2": "~1.0.2", - "indexof": "0.0.1", "parseuri": "0.0.6", - "socket.io-parser": "4.0.1-rc1" + "socket.io-parser": "4.0.1-rc2" }, "devDependencies": { "@babel/core": "^7.11.6", diff --git a/tsconfig.json b/tsconfig.json index bd40c1107..8cd92f0d6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,8 +4,7 @@ "allowJs": false, "target": "es2017", "module": "commonjs", - "declaration": true, - "allowSyntheticDefaultImports": true + "declaration": true }, "include": [ "./lib/**/*"