I have an application using socket.io, and socket.emit()
is not working from mobile chrome (on Android and iOS).
I can see that the socket.emit()
is getting executed in the browser.
But my server-side console.log statements in socket.on()
are not running, so I think messages are not getting there. I see no errors in the console either.
Interestingly though, everything works fine in incognito mode, plus all modes in other mobile browsers like Safari.
Any solutions, or help with debugging would be helpful.
EDIT:
CLIENT SIDE CODE
$(document).ready(function(){
socket = io();
$(".check").on("submit", function(event){
event.preventDefault();
ga('send','event','evt','evt123');
socket.emit('checkRoom', { rId: "12345", pId: "johndoe"});
});
});
SERVER SIDE CODE
io.on('connection', function(socket) {
console.log('a user connected');
socket.on('check',function(e){
console.log('Entered check');
socket.emit('check','server message');
});
});
EDIT2:
I manually specified the socket.io-1.3.5.js
file on the client side (instead of using the default /socket.io/socket.io.js
) and started seeing this error in the console:
WebSocket connection to 'ws://mydomain.com/socket.io/?EIO=3&transport=websocket&sid=wr8UpsT45lrWHtpMACJs' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT