Friday 28 April 2017

node socket.io not working using VPN

Everything's work fine but some user's can't read my socket even, I use VPN my socket stop having an error ERR_CONNECTION_TIMED_OUT even I use 0.0.0.0 still not working

Server.js

var socket = require('socket.io');

var express = require('express');

var app = express();

var server = require('http').createServer(app);

var io = socket.listen(server);

var port = process.env.PORT || 9090;

db.connect();

app.get('/', function (req, res) {

res.send('connected')

})

server.listen(port, 'website-ip', function () {

console.log('Server listening at port %d', port);

});

App.js

socket = io.connect('http://'+window.location.hostname+':9090');



via Aki

No comments:

Post a Comment