dwyl / hapi-socketio-redis-chat-example

:speech_balloon: Real-time Chat using Hapi.js + Socket.io + Redis Pub/Sub (example with tests!!)
GNU General Public License v2.0
366 stars 73 forks source link

socket io transport polling #72

Open VitaliyKovtun opened 7 years ago

VitaliyKovtun commented 7 years ago

If you have got http://127.0.0.1:8000/socket.io/?EIO=3&transport=polling&t= You have to write

var Hapi = require('hapi'); var server = new Hapi.Server();

server.connection({ host: '0.0.0.0', port: Number(process.env.PORT) });

var io = require('socket.io')(server.listener);

server.start();

AlieCat commented 7 years ago

Wow thanks for this, was pulling my hair.

Now I'm getting a new error:

VM48:161 WebSocket connection to 'ws://cathat.herokuapp.com/socket.io/?EIO=3&transport=websocket&sid=xzv44seT0HkGSJ6UAAAH' failed: Error during WebSocket handshake: Unexpected response code: 400

But everything seems to be working fine, so I guess I'll come back to that

FaizanZahid commented 6 years ago

iam getting

WebSocket connection to 'ws://127.0.0.1/socket.io/?EIO=3&transport=websocket&sid=ulyicDBxzzDdEI_KAAAT' failed: WebSocket is closed before the connection is established.

when trying to run the chat on pm2 cluster mode, i think we need to use transport websocket instead of polling? where do i do that?