Skip to content

ERR_CONNECTION_REFUSED http://localhost:3000/

Ciao, I’m implementing a webRTC many-to-many videoconferencing system, actually, I already did it, I am using socket.IO as signalling server, and everything goes super well, I am using EnterpriseDB Apache for serving my .html file on port (8081) and Node.js for serving socket.IO on port (3000), It is working like charm in localhost, no errors, My ISSUE is serving for external access with my public IP, I am testing with my friends and these browsing services: and (trial versions).

  • with, everything is working fine with either mozilla 42 or chrome 47

  • with, I got these errors

    Firefox 41: ReferenceError: io is not defined

    Chrome 45: Failed to load resource http://localhost:3000/ net::ERR_CONNECTION_REFUSED Uncaught ReferenceError: io is not defined

  • with my friends, I am having the same issues as, but they are using the latest browser versions (Chrome 47 and Firefox 42) for connecting to my PC server.

I think this is not a browser version issue, The issue is on serving the file, finally, here is my code:

It shows just the important things in order to solve this problem:

var port = 3000;
var io = require('').listen(port);
io.sockets.on('connection', function (socket){.........}
//Connect to signalling server
var socket = io.connect("http://localhost:3000");
<!DOCTYPE html>
<html lang="es">
    <head><meta charset="UTF-8">
        <script src="http://localhost:3000/"></script>
        <script src="js/clientside.js"></script>

this is my server URL if anyone wants to try:


localhost is a special host name that points to the same computer as the one requesting it. So anyone using a different computer than yours and trying to connect to localhost will try to connect to its own computer, not yours. As the server is not running on their computer, they quite obviously get a “connection refused” error.

You need to replace localhost with a globally accessible address (domain name or IP address). This also implies that you need to have your router map your external IP address to your computer running the server for this port (otherwise they will connect to your router, not your server).