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
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 });
This method was kept for backward-compatibility with pre-1.0 versions.
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
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 });
This method was kept for backward-compatibility with pre-1.0 versions.