Well, I hope this question isn't silly or repeated. I promise I have researched and tested a lot.
I've have a server on my VPS with this code:
var app = require('express')();
var server = require('http').Server(app);
var io = require('socket.io')(server);
server.listen(8080);
io.on('connection', function(socket) {
socket.on('hello', function() {
console.log('Hello received');
}
}
And a client in another machine:
<script>
var socket = io.connect('http://[VPS Public IP]:8080');
io.emit('hello');
</script>
This works when using private IP addresses and the same net. When using public IP this doesn't work. Any idea of why is this happening?
Thank you.
via A. Alcazar
No comments:
Post a Comment