Socket.io - failed: Connection closed before receiving a handshake response

前端 未结 5 1374
庸人自扰
庸人自扰 2021-01-01 15:24

Socket.io for NodeJS doesn\'t seem to work as a websocket server

For some reason, socket.io ALWAYS fallback to the long polling and if I force the w

5条回答
  •  死守一世寂寞
    2021-01-01 16:08

    In my case the problem was that I am proxying the server through browser-sync

    browserSync({
        //server: {
        //  // src is included for use with sass source maps
        //  baseDir: ['public', 'src']
        //},
        proxy: "localhost:4045",
        port: 4046
    

    So this will fail, however in production it works fine.

提交回复
热议问题