Node.js with Socket.io - Long Polling fails and throws “code”:1,“message”:“Session ID unknown” response

前端 未结 5 1595
南笙
南笙 2021-01-04 02:43

I\'m stuck on why a node.js app that was moved to an IIS7 server is now failing. I know IIS7 doesn\'t support web sockets but my understanding was that socket.io would fall

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-04 03:16

    for me, it was with nginx ssl http2, and it was polling, so the good config is:

     const ioSocket = io('', {
          // Send auth token on connection, you will need to DI the Auth service above
          // 'query': 'token=' + Auth.getToken()
          path: '/socket.io',
          transports: ['websocket'],
          secure: true,
        });
    

提交回复
热议问题