Bug Fixes
- only set 'connected' to true after middleware execution (02b0f73)
Features
- add an implementation based on uWebSockets.js (c0d8c5a)
const { App } = require("uWebSockets.js");
const { Server } = require("socket.io");
const app = new App();
const io = new Server();
io.attachApp(app);
io.on("connection", (socket) => {
// ...
});
app.listen(3000, (token) => {
if (!token) {
console.warn("port already in use");
}
});
- add timeout feature (f0ed42f)
socket.timeout(5000).emit("my-event", (err) => {
if (err) {
// the client did not acknowledge the event in the given delay
}
});
interface SocketData {
name: string;
age: number;
}
const io = new Server<ClientToServerEvents, ServerToClientEvents, InterServerEvents, SocketData>();
io.on("connection", (socket) => {
socket.data.name = "john";
socket.data.age = 42;
});
Links:
- Diff: 4.3.2...4.4.0
- Client release: 4.4.0
- engine.io version:
~6.1.0
(diff) - ws version:
~8.2.3