new Server(port[, options]);

优质
小牛编辑
137浏览
2023-12-01
  • port (数值型):要监听的端口号(如此一来 httpServer将会被自动创建)。
  • options (对象):同上方的配置
const server = require('http').createServer();

const io = require('socket.io')(3000, {
  path: '/test',
  serveClient: false,
  // below are engine.IO options
  pingInterval: 10000,
  pingTimeout: 5000,
  cookie: false
});