I'm using socket.io to establish communication between server and html5 client and everything is working fine on desktop and safari on iPhone simulator. The client fails to establish connection though when I try to run it from any iOS or even android device.
Using web inspector, I was unable to output console error on my ios7 device, but managed to get a list of resource with an item under XHR attempting to connect to the server ip address and fails after about 2 to 3 minutes (turns red)
My iOS device is iOS 7.03 (iPhone 4), and I'm using node v0.10.21, and socket.io v0.9.16 I'm also using ip addresses to connect so I'm not sure if there is a same domain restriction that applies
The following are the relevant parts from the client:
<script src="http://xx.xx.xx.xx:port/socket.io/socket.io.js"></script>
var socket = io.connect("http://xx.xx.xx.xx:port");
socket.on('connect', function() {
console.log("connected");
}
socket.on('disconnect', function() {
console.log("disconencted");
}
socket.on('message', function(data) {
console.log("rcved:"+ data*emphasized text*);
}
server
var io = require('socket.io').listen(12321).set('log level', 0);
var ConnectionHandler = require('./handler.js');
io.sockets.on('connection', function (socket) {
new ConnectionHandler(socket);
});
Might I also point out that when I enable full logging on server side, no connection are attempt for a connection is made from mobile devices, just the desktop devices and iOS simulator.
Any suggestions on a fix or how to pursue a solution to this problem is appreciated