unstale

npm / socket.io

socket.io

What changed in socket.io 2 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-23.

18 breaking1 deprecations8 new APIs and options1 performance2 behavior and defaults9 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.2.3 on npm

socket.io 414 changes

Breaking changes 2

  • Stateful regular expressions are rejected for dynamic namespaces.

    4.8.4release notes

  • Calling io.to(...) or another broadcast modifier now returns an immutable instance, preventing later broadcasts from being affected by earlier calls.

    4.0.0release notes

Deprecations 1

  • url.parse() is deprecated and has been replaced by new URL().

    4.8.2release notes

New APIs and options 4

Fixes and other changes 7

  • The types allow emitWithAck() for events with void callbacks.

    4.8.4release notes

  • The http module is imported correctly in the types.

    4.8.4release notes

  • Pending acknowledgements are cleaned up on timeout to prevent a memory leak.

    4.8.4release notes

  • Prevents uWebSockets.js from serving missing client files.

    4.8.4release notes

  • Calling io.close() on a stopped server no longer throws.

    4.8.3release notes

  • adapter.init() is now called when creating each namespace.

    4.8.2release notes

  • The io.close() function was improved.

    4.8.2release notes

socket.io 317 changes

Breaking changes 14

  • Clients with no namespace are now closed.

    3.0.0release notes

  • The connected map was renamed to sockets.

    3.0.0release notes

  • Connecting to a different namespace no longer implicitly connects to the default namespace.

    3.0.0release notes

  • The Engine.IO id is no longer reused.

    3.0.0release notes

  • Middleware errors now emit an Error object.

    3.0.0release notes

  • Namespace#connected is now a Map instead of an object.

    3.0.0release notes

  • The origins option was removed; configure CORS with cors and use allowRequest for validation.

    3.0.0release notes

  • Using reserved event names now throws.

    3.0.0release notes

  • The backward-compatibility Server#set() method was removed.

    3.0.0release notes

  • Socket#binary() was removed; this use case is covered by providing a custom parser.

    3.0.0release notes

  • Socket#join() is synchronous and no longer accepts a callback; custom adapters can use await.

    3.0.0release notes

  • Socket#leave() is synchronous and no longer accepts a callback argument; custom adapters can use await.

    3.0.0release notes

  • Socket#rooms is now a Set instead of an object.

    3.0.0release notes

  • The Socket#use() method was removed.

    3.0.0release notes

New APIs and options 3

socket.io 28 changes

Breaking changes 2

  • null is no longer accepted as an argument.

    2.0.0release notes

  • A breaking change to utf-8 encoding in engine.io-parser makes this release not backward-compatible.

    2.0.0release notes

New APIs and options 1

  • Applications can provide a custom parser to meet their needs.

    2.0.0release notes

Performance 1

  • Engine.IO and Socket.IO handshake packets were merged, reducing the roundtrips needed to establish a connection.

    2.0.0release notes

Behavior and default changes 2

  • The join method now allows joining several rooms at once.

    2.0.0release notes

  • path.resolve is used by default, with require.resolve as a fallback.

    2.0.0release notes

Fixes and other changes 2

  • Connections are now properly closed on error.

    2.0.0release notes

  • The socket id on the client now matches the id on the server-side.

    2.0.0release notes