📜  socket io express - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:29.639000             🧑  作者: Mango

代码示例6
const app = require("express")();const httpServer = require("http").createServer(app);const options = { /* ... */ };const io = require("socket.io")(httpServer, options);io.on("connection", socket => { /* ... */ });httpServer.listen(3000);// WARNING !!! app.listen(3000); will not work here, as it creates a new HTTP server