Skip to content

Releases: socketio/socket.io

4.5.0

24 Apr 20:19
8ecfcba
Compare
Choose a tag to compare

Bug Fixes

  • typings: ensure compatibility with TypeScript 3.x (#4259) (02c87a8)

Features

  • add support for catch-all listeners for outgoing packets (531104d)

This is similar to onAny(), but for outgoing packets.

Syntax:

socket.onAnyOutgoing((event, ...args) => {
  console.log(event);
});
  • broadcast and expect multiple acks (8b20457)

Syntax:

io.timeout(1000).emit("some-event", (err, responses) => {
  // ...
});
  • add the "maxPayload" field in the handshake details (088dcb4)

So that clients in HTTP long-polling can decide how many packets they have to send to stay under the maxHttpBufferSize
value.

This is a backward compatible change which should not mandate a new major revision of the protocol (we stay in v4), as
we only add a field in the JSON-encoded handshake data:

0{"sid":"lv_VI97HAXpY6yYWAAAC","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000,"maxPayload":1000000}

Links:

4.4.1

06 Jan 06:45
c82a4bd
Compare
Choose a tag to compare

Bug Fixes

  • types: make RemoteSocket.data type safe (#4234) (770ee59)
  • types: pass SocketData type to custom namespaces (#4233) (f2b8de7)

Links:

4.4.0

18 Nov 13:20
0f11c47
Compare
Choose a tag to compare

Bug Fixes

  • only set 'connected' to true after middleware execution (02b0f73)

Features

  • add an implementation based on uWebSockets.js (c0d8c5a)
const { App } = require("uWebSockets.js");
const { Server } = require("socket.io");

const app = new App();
const io = new Server();

io.attachApp(app);

io.on("connection", (socket) => {
  // ...
});

app.listen(3000, (token) => {
  if (!token) {
    console.warn("port already in use");
  }
});
socket.timeout(5000).emit("my-event", (err) => {
  if (err) {
    // the client did not acknowledge the event in the given delay
  }
});
interface SocketData {
  name: string;
  age: number;
}

const io = new Server<ClientToServerEvents, ServerToClientEvents, InterServerEvents, SocketData>();

io.on("connection", (socket) => {
  socket.data.name = "john";
  socket.data.age = 42;
});

Links:

4.3.2

08 Nov 05:45
ed8483d
Compare
Choose a tag to compare

Bug Fixes

  • fix race condition in dynamic namespaces (#4137) (9d86397)

Links:

4.3.1

16 Oct 23:15
ccc5ec3
Compare
Choose a tag to compare

Bug Fixes

Links:

4.3.0

15 Oct 07:01
95810aa
Compare
Choose a tag to compare

For this release, most of the work was done on the client side, see here.

Bug Fixes

  • typings: add name field to cookie option (#4099) (033c5d3)
  • send volatile packets with binary attachments (dc81fcf)

Features

Links:

4.2.0

30 Aug 07:26
c100b7b
Compare
Choose a tag to compare

Bug Fixes

  • typings: allow async listener in typed events (ccfd8ca)

Features

  • ignore the query string when serving client JavaScript (#4024) (24fee27)

Links:

4.1.3

30 Aug 07:25
dbd2a07
Compare
Choose a tag to compare

Bug Fixes

  • fix io.except() method (94e27cd)
  • remove x-sourcemap header (a4dffc6)

Links:

4.1.2

17 May 21:22
1633150
Compare
Choose a tag to compare

Bug Fixes

  • typings: ensure compatibility with TypeScript 3.x (0cb6ac9)
  • ensure compatibility with previous versions of the adapter (a2cf248)

Links:

4.1.1

11 May 22:09
995f38f
Compare
Choose a tag to compare

Bug Fixes

  • typings: properly type server-side events (b84ed1e)
  • typings: properly type the adapter attribute (891b187)

Links: