I am new to socket IO and all, I’ve been working with it for about the last month, but I have noticed over the time that if I let my website sit and not do anything for a small amount of time, (Im not sure how much), but it seems to timeout, and the events aren’t called unless I reload the page. There must be a way to fix this?
my server code:
var io = require('socket.io').listen(4000);
var users = {};
io.disable('heartbeats');
////////////////USER CONNECTED
io.sockets.on('connection', function (socket) {
socket.emit('connected');
socket.on('session', function (session) {
///all my other functions here
});
});
then included on my page is:
<script>var socket = io.connect("http://<?php print $_SERVER["SERVER_NAME"]?>",
{port: 4000, 'reconnect': true,'reconnection delay': 1500});</script>
<script type="text/javascript" src="js/ws/data/data.js"></script>
data.js is where all of my socket io functions are for the user end.
Try removing this line:
See Configuring Socket.IO.