# What changed in socket.io

> 39 changes in socket.io 2 to 4 from its official release notes, upgrade guides and advisories: 18 breaking, 1 deprecations, 8 new APIs and options. Each one cited. Sources checked 2026-10-23. HTML: https://unstale.sh/npm/socket.io/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## socket.io 4

### Breaking changes

- Stateful regular expressions are rejected for dynamic namespaces. (4.8.4) — [release notes](https://github.com/socketio/socket.io/releases/tag/socket.io%404.8.4)
- Calling io.to(...) or another broadcast modifier now returns an immutable instance, preventing later broadcasts from being affected by earlier calls. (4.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/4.0.0)

### Deprecations

- url.parse() is deprecated and has been replaced by new URL(). (4.8.2) — [release notes](https://github.com/socketio/socket.io/releases/tag/socket.io%404.8.2)

### New APIs and options

- io.to(...) now accepts an array. (4.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/4.0.0)
- Broadcasting can exclude specific rooms. (4.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/4.0.0)
- Support for typed events was added. (4.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/4.0.0)
- Some utility methods were added. (4.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/4.0.0)

### Fixes and other changes

- The types allow emitWithAck() for events with void callbacks. (4.8.4) — [release notes](https://github.com/socketio/socket.io/releases/tag/socket.io%404.8.4)
- The http module is imported correctly in the types. (4.8.4) — [release notes](https://github.com/socketio/socket.io/releases/tag/socket.io%404.8.4)
- Pending acknowledgements are cleaned up on timeout to prevent a memory leak. (4.8.4) — [release notes](https://github.com/socketio/socket.io/releases/tag/socket.io%404.8.4)
- Prevents uWebSockets.js from serving missing client files. (4.8.4) — [release notes](https://github.com/socketio/socket.io/releases/tag/socket.io%404.8.4)
- Calling io.close() on a stopped server no longer throws. (4.8.3) — [release notes](https://github.com/socketio/socket.io/releases/tag/socket.io%404.8.3)
- adapter.init() is now called when creating each namespace. (4.8.2) — [release notes](https://github.com/socketio/socket.io/releases/tag/socket.io%404.8.2)
- The io.close() function was improved. (4.8.2) — [release notes](https://github.com/socketio/socket.io/releases/tag/socket.io%404.8.2)

## socket.io 3

### Breaking changes

- Clients with no namespace are now closed. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- The connected map was renamed to sockets. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- Connecting to a different namespace no longer implicitly connects to the default namespace. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- The Engine.IO id is no longer reused. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- Middleware errors now emit an Error object. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- Namespace#connected is now a Map instead of an object. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- The origins option was removed; configure CORS with cors and use allowRequest for validation. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- Using reserved event names now throws. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- The backward-compatibility Server#set() method was removed. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- Socket#binary() was removed; this use case is covered by providing a custom parser. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- Socket#join() is synchronous and no longer accepts a callback; custom adapters can use await. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- Socket#leave() is synchronous and no longer accepts a callback argument; custom adapters can use await. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- Socket#rooms is now a Set instead of an object. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- The Socket#use() method was removed. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)

### New APIs and options

- Catch-all listeners are now supported. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- An ES6 module export is now available. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)
- A msgpack bundle is now served. (3.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/3.0.0)

## socket.io 2

### Breaking changes

- null is no longer accepted as an argument. (2.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/2.0.0)
- A breaking change to utf-8 encoding in engine.io-parser makes this release not backward-compatible. (2.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/2.0.0)

### New APIs and options

- Applications can provide a custom parser to meet their needs. (2.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/2.0.0)

### Performance

- Engine.IO and Socket.IO handshake packets were merged, reducing the roundtrips needed to establish a connection. (2.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/2.0.0)

### Behavior and default changes

- The join method now allows joining several rooms at once. (2.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/2.0.0)
- path.resolve is used by default, with require.resolve as a fallback. (2.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/2.0.0)

### Fixes and other changes

- Connections are now properly closed on error. (2.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/2.0.0)
- The socket id on the client now matches the id on the server-side. (2.0.0) — [release notes](https://github.com/socketio/socket.io/releases/tag/2.0.0)
