I am running a node.js server on port 3000 and it works fine when I aceess it on localhost:3000 on my local system. I am also printing the mouse co-ordinates on to the console using
socket.broadcast.emit('mouse',data);
But I wanted to make this work on a remote system like my mobile. So when I looked up I found out that I should change my server code from
.listen(3000);
to
.listen(3000,'0.0.0.0');
and using my local ip address 192.168.x.x:3000 I was able to get the client on my mobile. But I am not able to receive the mouse co-ordinates on the console when I access the client on my mobile. I have used socket.io to create a websocket. Both my mobile and laptop are connected to the same wi-fi. I tried disabling the firewall also.
My server code:
var server = app.listen(3000,'0.0.0.0');
app.use(express.static('public'));
var socket = require('socket.io');
var io=socket(server);
io.sockets.on('connection',newConnection);
function newConnection(socket)
{
console.log('new connection:' + socket.id );
socket.on('mouse',mouseMsg);
function mouseMsg(data){
socket.broadcast.emit('mouse',data);
console.log(data);
}
}