[bug] Cannot read property 'indexOf' of undefined in engine.io/lib/server.js:132:24
Current behaviour
[2017-04-20 11:01:35.003] [ERROR] console - Caught exception: TypeError: Cannot read property 'indexOf' of undefined
at Server.verify (/root/WebstormProjects/treasures/game-server/node_modules/engine.io/lib/server.js:132:24)
at Server.handleRequest (/root/WebstormProjects/treasures/game-server/node_modules/engine.io/lib/server.js:205:8)
at Server.<anonymous> (/root/WebstormProjects/treasures/game-server/node_modules/engine.io/lib/server.js:432:12)
at Server.<anonymous> (/root/WebstormProjects/treasures/game-server/node_modules/socket.io/lib/index.js:275:16)
at emitTwo (events.js:106:13)
at Server.emit (events.js:192:7)
at parserOnIncoming (_http_server.js:565:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
when I use socket.io-client to connect to socket.io server. The server side print error.
Environment
- OS: ubuntu 16.04
- browser: server side bug
- socket.io version: 1.7.2
Could you please provide more details? How are you initializing your server (especially the transports options here)?
@darrachequesne Thank you very much, I know the answer. It's because the open source server side(called pomelo) doesn't init the transports. Thank you very very much.
@SteveCruise Hi, please, would you be able to tell me how you fixed this? :)
while initializing pomelo app like on server
var app = pomelo.createApp(); app.set('name', 'demo');
app.configure('production|development', function(){ });
add connector config with transports
app.set('connectorConfig',
{
connector : pomelo.connectors.sioconnector,
// 'websocket', 'polling-xhr', 'polling-jsonp', 'polling'
transports : ['websocket', 'polling'],
heartbeats : true,
closeTimeout : 70 * 1000,
heartbeatTimeout : 60 * 1000,
heartbeatInterval : 35 * 1000
});
Hey guys, Im trying to install Node-poker-stack-master and I had the same problem. Can anyone give me directions how to solve that "TypeError: Cannot read property 'indexOf' of undefined" ?
@SteveCruise If you solved it I would much appreciate explanation. Tnx.