Skip to content

Releases: socketio/socket.io

3.0.0-rc3

27 Oct 20:29
cacad70
Compare
Choose a tag to compare
3.0.0-rc3 Pre-release
Pre-release

Features

  • add support for catch-all listeners (5c73733)
  • make Socket#join() and Socket#leave() synchronous (129c641)
  • remove prod dependency to socket.io-client (7603da7)

BREAKING CHANGES

  • the Socket#use() method is removed (see 5c73733)

  • Socket#join() and Socket#leave() do not accept a callback argument anymore.

Before:

socket.join("room1", () => {
 io.to("room1").emit("hello");
});

After:

socket.join("room1");
io.to("room1").emit("hello");
// or await socket.join("room1"); for custom adapters

Links:

3.0.0-rc2

15 Oct 11:57
0ce5b4c
Compare
Choose a tag to compare
3.0.0-rc2 Pre-release
Pre-release

Bug Fixes

  • close clients with no namespace (91cd255)

Code Refactoring

  • remove duplicate _sockets map (8a5db7f)

Features

  • move binary detection back to the parser (669592d)

BREAKING CHANGES

  • the "connected" map is renamed to "sockets"
  • the Socket#binary() method is removed, as this use case is now covered by the ability to provide your own parser.

Links:

3.0.0-rc1

13 Oct 22:46
ebb0575
Compare
Choose a tag to compare
3.0.0-rc1 Pre-release
Pre-release

Features

  • add ES6 module export (8b6b100)
  • do not reuse the Engine.IO id (2875d2c)
  • remove Server#set() method (029f478)
  • remove Socket#rooms object (1507b41)
  • remove the 'origins' option (a8c0600)
  • remove the implicit connection to the default namespace (3289f7e)
  • throw upon reserved event names (4bd5b23)

BREAKING CHANGES

  • the 'origins' option is removed

Before:

new Server(3000, {
  origins: ["https://example.com"]
});

The 'origins' option was used in the allowRequest method, in order to
determine whether the request should pass or not. And the Engine.IO
server would implicitly add the necessary Access-Control-Allow-xxx
headers.

After:

new Server(3000, {
  cors: {
    origin: "https://example.com",
    methods: ["GET", "POST"],
    allowedHeaders: ["content-type"]
  }
});

The already existing 'allowRequest' option can be used for validation:

new Server(3000, {
  allowRequest: (req, callback) => {
    callback(null, req.headers.referer.startsWith("https://example.com"));
  }
});
  • Socket#rooms is now a Set instead of an object

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

  • there is no more implicit connection to the default namespace:

// client-side
const socket = io("/admin");

// server-side
io.on("connect", socket => {
  // not triggered anymore
})

io.use((socket, next) => {
  // not triggered anymore
});

io.of("/admin").use((socket, next) => {
  // triggered
});
  • the Server#set() method was removed

This method was kept for backward-compatibility with pre-1.0 versions.

Links:

2.3.0

28 Sep 09:48
47161a6
Compare
Choose a tag to compare

This release mainly contains a bump of the engine.io and ws packages, but no additional features.

Links:

2.2.0

29 Nov 11:39
df05b73
Compare
Choose a tag to compare

Features

  • add cache-control header when serving the client source (#2907)

Bug fixes

  • throw an error when trying to access the clients of a dynamic namespace (#3355)

Links

2.1.1

23 May 20:24
e0b2cb0
Compare
Choose a tag to compare

Features

  • add local flag to the socket object (#3219)
socket.local.to('room101').emit(/* */);

Bug fixes

(client) fire an error event on middleware failure for non-root namespace (socketio/socket.io-client#1202)

Links:

2.1.0

29 Mar 21:54
db831a3
Compare
Choose a tag to compare

Features

  • add a 'binary' flag (#3185)
// by default, the object is recursively scanned to check whether it contains some binary data
// in the following example, the check is skipped in order to improve performance
socket.binary(false).emit('plain-object', object);

// it also works at the namespace level
io.binary(false).emit('plain-object', object);
  • add support for dynamic namespaces (#3195)
io.of(/^\/dynamic-\d+$/).on('connect', (socket) => {
  // socket.nsp.name = '/dynamic-101'
});

// client-side
const client = require('socket.io-client')('/dynamic-101');

Bug fixes

  • properly emit 'connect' when using a custom namespace (#3197)
  • include the protocol in the origins check (#3198)

Important note ⚠️ from Engine.IO 3.2.0 release

There are two non-breaking changes that are somehow quite important:

  • ws was reverted as the default wsEngine (socketio/engine.io#550), as there was several blocking issues with uws. You can still use uws by running npm install uws --save in your project and using the wsEngine option:
var engine = require('engine.io');
var server = engine.listen(3000, {
  wsEngine: 'uws'
});

Links:

2.0.4

22 Oct 13:25
Compare
Choose a tag to compare

Bug fixes

  • do not throw when receiving an unhandled error packet (#3038)
  • reset rooms object before broadcasting from namespace (#3039)

Links:

2.0.3

13 Jun 05:51
Compare
Choose a tag to compare

Bug fixes

  • reset rooms object before broadcasting (#2970)
  • fix middleware initialization (#2969)

Links:

2.0.2

01 Jun 19:25
Compare
Choose a tag to compare

Bug fixes

  • fix timing issues with middleware (#2948)

Links: