MyGit

4.4.0

socketio/socket.io

版本发布时间: 2021-11-18 21:20:44

socketio/socket.io最新发布版本:2.5.1(2024-06-19 17:36:33)

Bug Fixes

Features

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");
  }
});
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:

相关地址:原始地址 下载(tar) 下载(zip)

查看:2021-11-18发行的版本