Releases: socketio/socket.io
3.0.2
Bug Fixes
- merge Engine.IO options (43705d7)
Links:
- Diff: 3.0.1...3.0.2
- Client release: 3.0.2
- engine.io version:
~4.0.0 - ws version:
^7.1.2
3.0.1
3.0.0
More details about this release in the blog post: https://socket.io/blog/socket-io-3-release/
Dedicated migration guide: https://socket.io/docs/migrating-from-2-x-to-3-0/
Bug Fixes
- close clients with no namespace (91cd255)
Features
- emit an Error object upon middleware error (54bf4a4)
- serve msgpack bundle (aa7574f)
- add support for catch-all listeners (5c73733)
- make Socket#join() and Socket#leave() synchronous (129c641)
- remove prod dependency to socket.io-client (7603da7)
- move binary detection back to the parser (669592d)
- 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 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- 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.
- 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:
- Diff: 2.3.0...3.0.0
- Client release: 3.0.0
- engine.io version:
~4.0.0 - ws version:
^7.1.2
3.0.0-rc4
3.0.0-rc3
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 adaptersLinks:
- Milestone: 3.0.0
- Diff: 3.0.0-rc2...3.0.0-rc3
- Client release: 3.0.0-rc3
- engine.io version:
~4.0.0 - ws version:
^7.1.2
3.0.0-rc2
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:
- Milestone: 3.0.0
- Diff: 3.0.0-rc1...3.0.0-rc2
- Client release: 3.0.0-rc2
- engine.io version:
~4.0.0 - ws version:
^7.1.2
3.0.0-rc1
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#roomsis now a Set instead of an object -
Namespace#connectedis 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:
- Milestone: 3.0.0
- Diff: 2.3.0...3.0.0-rc1
- Client release: 3.0.0-rc1
- engine.io version:
~4.0.0(diff: socketio/engine.io@3.4.0...4.0.0) - ws version:
^7.1.2
2.3.0
This release mainly contains a bump of the engine.io and ws packages, but no additional features.
Links:
- Milestone: 2.3.0
- Diff: 2.2.0...2.3.0
- Client release: 2.3.0
- engine.io version:
~3.4.0(diff: socketio/engine.io@3.3.1...3.4.2) - ws version:
^7.1.2(diff: websockets/ws@6.1.2...7.3.1)
2.2.0
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
- Milestone: 2.2.0
- Diff: 2.1.1...2.2.0
- Client release: 2.2.0
- engine.io version:
~3.3.1(diff: socketio/engine.io@3.2.0...3.3.1) - ws version:
~6.1.0(diff: websockets/ws@3.3.1...6.1.2)
2.1.1
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:
- Milestone: 2.1.1
- Diff: 2.1.0...2.1.1
- Client release: 2.1.1
- engine.io version:
~3.2.0 - ws version:
~3.3.1