Q:

net::ERR_CONNECTION_REFUSED socket.io

i'm trying to have a socket working on my sever
here is my app.js file
 console.log('app.js says hi');
 var express = require('express');  
 var app = express();  
 var server = require('http').createServer(app);  
 var io = require('socket.io')(server);
app.use(express.static(__dirname + '/bower_components'));  
app.get('/', function(req, res,next) {  
res.sendFile(__dirname + '/index.html');
});
server.listen(4200);  

and my index.html file 
     <! doctype html>  
     <html lang="en">  
     <head>

    </head>
    <body>
    <h1>Hello World!</h1>
    <div id="future"></div>
    <form id="form" id="chat_form">
        <input id="chat_input" type="text">
        <input type="submit" value="Send">
    </form>
     <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="socket.io.js"></script>    
    <script>  
 var socket = io.connect('http://localhost:4200');
socket.on('connect', function(data) {
    socket.emit('join', 'Hello World from client');
 });
</script>        
</body>
</html>  

and in the console log apperas this error
GET http://localhost:4200/socket.io/?EIO=3&transport=polling&t=LsOF2yq net::ERR_CONNECTION_REFUSED

A:

i found it
replace this line 
var socket = io.connect('http://localhost:4200');
with
var socket = io.connect('http://yourdomain.com:4200');

