POPMUISE
我不确定该响应是怎么回事。但我可以确认,当我使用 socket.io@2.1.1 和 console.log(io) 运行基本的 socket.io 示例时,我在终端中看到以下内容:Server { nsps: { '/': Namespace { name: '/', server: [Circular], sockets: [Object], connected: [Object], fns: [], ids: 0, rooms: [], flags: {}, adapter: [Adapter], _events: [Object: null prototype], _eventsCount: 1 } }, parentNsps: Map {}, _path: '/socket.io', _serveClient: true, parser: { protocol: 4, types: [ 'CONNECT', 'DISCONNECT', 'EVENT', 'ACK', 'ERROR', 'BINARY_EVENT', 'BINARY_ACK' ], CONNECT: 0, DISCONNECT: 1, EVENT: 2, ACK: 3, ERROR: 4, BINARY_EVENT: 5, BINARY_ACK: 6, Encoder: [Function: Encoder], Decoder: [Function: Decoder] }, encoder: Encoder {}, _adapter: [Function: Adapter], _origins: '*:*', sockets: Namespace { name: '/', server: [Circular], sockets: { WFrro9MpS4d1nSouAAAA: [Socket] }, connected: { WFrro9MpS4d1nSouAAAA: [Socket] }, fns: [], ids: 0, rooms: [], flags: {}, adapter: Adapter { nsp: [Circular], rooms: [Object], sids: [Object], encoder: Encoder {} }, _events: [Object: null prototype] { connection: [Array] }, _eventsCount: 1 }, eio: Server { clients: { WFrro9MpS4d1nSouAAAA: [Socket] }, clientsCount: 1, wsEngine: 'ws', pingTimeout: 5000, pingInterval: 25000, upgradeTimeout: 10000, maxHttpBufferSize: 100000000, transports: [ 'polling', 'websocket' ], allowUpgrades: true, allowRequest: [Function: bound ], cookie: 'io', cookiePath: '/', cookieHttpOnly: true, perMessageDeflate: { threshold: 1024 }, httpCompression: { threshold: 1024 }, initialPacket: [ '0' ], ws: WebSocketServer { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, options: [Object], [Symbol(kCapture)]: false }, _events: [Object: null prototype] { connection: [Function: bound ] }, _eventsCount: 1 }, httpServer: Server { insecureHTTPParser: undefined, _events: [Object: null prototype] { connection: [Function: connectionListener], close: [Function: bound ], listening: [Function: bound ], upgrade: [Function], request: [Function] }, _eventsCount: 5, _maxListeners: undefined, _connections: 2, _handle: TCP { reading: false, onconnection: [Function: onconnection], [Symbol(owner_symbol)]: [Circular] }, _usingWorkers: false, _workers: [], _unref: false, allowHalfOpen: true, pauseOnConnect: false, httpAllowHalfOpen: false, timeout: 120000, keepAliveTimeout: 5000, maxHeadersCount: null, headersTimeout: 60000, _connectionKey: '6::::8080', [Symbol(IncomingMessage)]: [Function: IncomingMessage], [Symbol(ServerResponse)]: [Function: ServerResponse], [Symbol(kCapture)]: false, [Symbol(asyncId)]: 6 }, engine: Server { clients: { WFrro9MpS4d1nSouAAAA: [Socket] }, clientsCount: 1, wsEngine: 'ws', pingTimeout: 5000, pingInterval: 25000, upgradeTimeout: 10000, maxHttpBufferSize: 100000000, transports: [ 'polling', 'websocket' ], allowUpgrades: true, allowRequest: [Function: bound ], cookie: 'io', cookiePath: '/', cookieHttpOnly: true, perMessageDeflate: { threshold: 1024 }, httpCompression: { threshold: 1024 }, initialPacket: [ '0' ], ws: WebSocketServer { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, options: [Object], [Symbol(kCapture)]: false }, _events: [Object: null prototype] { connection: [Function: bound ] }, _eventsCount: 1 }} 随着房间io.sockets.adapter.rooms。