Skip to content

Releases: socketio/socket.io

socket.io@4.8.0

21 Sep 08:05
d0fc720
Compare
Choose a tag to compare

Bug Fixes

  • allow to join a room in a middleware (uws) (b04fa64)
  • correctly await async close on adapters (#4971) (e347a3c)
  • expose type of default engine (132d05f)

Dependencies

socket.io-client@4.8.0

21 Sep 08:06
4a0555c
Compare
Choose a tag to compare

Features

Custom transport implementations

The transports option now accepts an array of transport implementations:

import { io } from "socket.io-client";
import { XHR, WebSocket } from "engine.io-client";

const socket = io({
  transports: [XHR, WebSocket]
});

Here is the list of provided implementations:

Transport Description
Fetch HTTP long-polling based on the built-in fetch() method.
NodeXHR HTTP long-polling based on the XMLHttpRequest object provided by the xmlhttprequest-ssl package.
XHR HTTP long-polling based on the built-in XMLHttpRequest object.
NodeWebSocket WebSocket transport based on the WebSocket object provided by the ws package.
WebSocket WebSocket transport based on the built-in WebSocket object.
WebTransport WebTransport transport based on the built-in WebTransport object.

Usage:

Transport browser Node.js Deno Bun
Fetch βœ… βœ… (1) βœ… βœ…
NodeXHR βœ… βœ… βœ…
XHR βœ…
NodeWebSocket βœ… βœ… βœ…
WebSocket βœ… βœ… (2) βœ… βœ…
WebTransport βœ… βœ…

(1) since v18.0.0
(2) since v21.0.0

Added in f4d898e and b11763b.

Test each low-level transports

When setting the tryAllTransports option to true, if the first transport (usually, HTTP long-polling) fails, then the other transports will be tested too:

import { io } from "socket.io-client";

const socket = io({
  tryAllTransports: true
});

This feature is useful in two cases:

  • when HTTP long-polling is disabled on the server, or if CORS fails
  • when WebSocket is tested first (with transports: ["websocket", "polling"])

The only potential downside is that the connection attempt could take more time in case of failure, as there have been reports of WebSocket connection errors taking several seconds before being detected (that's one reason for using HTTP long-polling first). That's why the option defaults to false for now.

Added in 579b243.

Bug Fixes

  • accept string | undefined as init argument (bis) (60c757f)
  • allow to manually stop the reconnection loop (13c6d2e)
  • close the engine upon decoding exception (04c8dd9)
  • do not send a packet on an expired connection (#5134) (8adcfbf)

Dependencies

engine.io@6.6.1

21 Sep 07:49
2b60df1
Compare
Choose a tag to compare

Bug Fixes

  • discard all pending packets when the server is closed (923a12e)
  • uws: prevent the client from upgrading twice (d5095fe)

Dependencies

engine.io-client@6.6.1

21 Sep 07:15
c251ae7
Compare
Choose a tag to compare

Bug Fixes

  • move 'offline' event listener at the top (8a2f5a3)
  • only remove the event listener if it exists (9b3c9ab)
  • do not send a packet on an expired connection (#5134) (8adcfbf)

Performance Improvements

  • do not reset the heartbeat timer on each packet (7a23dde)

Dependencies

engine.io-parser@5.2.3

21 Sep 07:51
f00fc89
Compare
Choose a tag to compare

Bug Fixes

  • do not expose the TransformStream type (f9cb983)

2.5.1

19 Jun 09:36
88b2cdb
Compare
Choose a tag to compare

Bug Fixes

  • add a noop handler for the error event (d30630b)

Links:

  • Diff: 2.5.0...2.5.1
  • Client release: -
  • engine.io version: ~3.6.0 (no change)
  • ws version: ~7.5.10

4.7.5

14 Mar 17:06
5017681
Compare
Choose a tag to compare

Bug Fixes

  • close the adapters when the server is closed (bf64870)
  • remove duplicate pipeline when serving bundle (e426f3e)

Links

4.7.4

12 Jan 10:39
6ab2509
Compare
Choose a tag to compare

Bug Fixes

  • typings: calling io.emit with no arguments incorrectly errored (cb6d2e0), closes #4914

Links

4.7.3

03 Jan 20:40
0d89319
Compare
Choose a tag to compare

Bug Fixes

  • return the first response when broadcasting to a single socket (#4878) (df8e70f)
  • typings: allow to bind to a non-secure Http2Server (#4853) (8c9ebc3)

Links

4.7.2

02 Aug 23:57
c332643
Compare
Choose a tag to compare

Bug Fixes

  • clean up child namespace when client is rejected in middleware (#4773) (0731c0d)
  • webtransport: properly handle WebTransport-only connections (3468a19)
  • webtransport: add proper framing (a306db0)

Links