3.0.0-rc1
Pre-release
Pre-release
darrachequesne
released this
13 Oct 22:46
·
152 commits
to master
since this 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:
- 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