diff --git a/lib/index.ts b/lib/index.ts index b3350abc92..dcbbd230e0 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -43,7 +43,7 @@ type ParentNspNameMatchFn = ( interface EngineOptions { /** * how many ms without a pong packet to consider the connection closed - * @default 5000 + * @default 20000 */ pingTimeout: number; /** @@ -93,10 +93,12 @@ interface EngineOptions { httpCompression: boolean | object; /** * what WebSocket server implementation to use. Specified module must - * conform to the ws interface (see ws module api docs). Default value is ws. - * An alternative c++ addon is also available by installing uws module. + * conform to the ws interface (see ws module api docs). + * An alternative c++ addon is also available by installing eiows module. + * + * @default `require("ws").Server` */ - wsEngine: string; + wsEngine: Function; /** * an optional packet which will be concatenated to the handshake packet emitted by Engine.IO. */ diff --git a/package-lock.json b/package-lock.json index 4140bcf9db..ac0583e45a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1206,9 +1206,9 @@ } }, "engine.io": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-4.1.0.tgz", - "integrity": "sha512-vW7EAtn0HDQ4MtT5QbmCHF17TaYLONv2/JwdYsq9USPRZVM4zG7WB3k0Nc321z8EuSOlhGokrYlYx4176QhD0A==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-5.0.0.tgz", + "integrity": "sha512-BATIdDV3H1SrE9/u2BAotvsmjJg0t1P4+vGedImSs1lkFAtQdvk4Ev1y4LDiPF7BPWgXWEG+NDY+nLvW3UrMWw==", "requires": { "accepts": "~1.3.4", "base64id": "2.0.0", diff --git a/package.json b/package.json index a350cd78b0..30e97e7b77 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "accepts": "~1.3.4", "base64id": "~2.0.0", "debug": "~4.3.1", - "engine.io": "~4.1.0", + "engine.io": "~5.0.0", "socket.io-adapter": "~2.2.0", "socket.io-parser": "~4.0.3" }, diff --git a/test/socket.io.ts b/test/socket.io.ts index 0733feee81..9678496b77 100644 --- a/test/socket.io.ts +++ b/test/socket.io.ts @@ -228,7 +228,7 @@ describe("socket.io", () => { }); request .options("http://localhost:54013/socket.io/default/") - .query({ transport: "polling" }) + .query({ transport: "polling", EIO: 4 }) .set("Origin", "http://localhost:54023") .end((err, res) => { expect(res.status).to.be(204); @@ -256,7 +256,7 @@ describe("socket.io", () => { }); request .get("http://localhost:54014/socket.io/default/") - .query({ transport: "polling" }) + .query({ transport: "polling", EIO: 4 }) .set("Origin", "http://localhost:54024") .end((err, res) => { expect(res.status).to.be(200); @@ -276,7 +276,7 @@ describe("socket.io", () => { request .get("http://localhost:54022/socket.io/default/") - .query({ transport: "polling" }) + .query({ transport: "polling", EIO: 4 }) .end((err, res) => { expect(res.status).to.be(200); done(); @@ -290,7 +290,7 @@ describe("socket.io", () => { request .get("http://localhost:54023/socket.io/default/") .set("origin", "http://foo.example") - .query({ transport: "polling" }) + .query({ transport: "polling", EIO: 4 }) .end((err, res) => { expect(res.status).to.be(403); done();