我正在制作一个游戏,我想创建 2 用户房间,当我尝试获取用户数量时
io.sockets.emit('roomUsers', io.sockets.clients(openRoom).lenght);
node.js 崩溃
这是我得到的日志,我不知道这是什么意思:
/Users/ilya/game-app-1/node_modules/socket.io/lib/parser.js:75
data = JSON.stringify(ev);
^
TypeError: Converting circular structure to JSON
at Object.stringify (native)
at Object.exports.encodePacket (/Users/ilya/game-app-1/node_modules/socket.io/lib/parser.js:75:19)
at SocketNamespace.packet (/Users/ilya/game-app-1/node_modules/socket.io/lib/namespace.js:154:23)
at SocketNamespace.emit (/Users/ilya/game-app-1/node_modules/socket.io/lib/namespace.js:188:15)
at Socket.<anonymous> (/Users/ilya/game-app-1/app.js:101:14)
at Socket.EventEmitter.emit [as $emit] (events.js:96:17)
at SocketNamespace.handlePacket (/Users/ilya/game-app-1/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/Users/ilya/game-app-1/node_modules/socket.io/lib/manager.js:488:38)
at WebSocket.Transport.onMessage (/Users/ilya/game-app-1/node_modules/socket.io/lib/transport.js:387:20)
at Parser.<anonymous> (/Users/ilya/game-app-1/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)