I have a site which, when less than ~100 people are on it, works fine. But after that point, I often get an error saying:
WebSocket connection to ' failed: Error during WebSocket handshake: Unexpected response code: 400
Followed by a bunch of Post errors
GET <my server> 400 (Bad Request)
If I refresh the site a couple times, it works. I am so lost as to why this is happening. Any suggestions?
Here's my code in brief:
//server side
app.set('port', process.env.PORT || 8081);
var server = require('http').createServer(app);
var io = require('socket.io')(server);
server.listen(8081);
//client side
var origin = window.location.origin;
console.log("origin is: " + origin);
var socket = io.connect(origin);
I'm using Express and decided to use socket.io to talk between the app.js(server) and index.html (client). Literally all I'm doing is updating a hashtable on client side. Are there any other alternatives to using socket.io to talk between client and server?
via Chris Jones
No comments:
Post a Comment