question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

net::ERR_CONNECTION_REFUSED

See original GitHub issue

Hey guys i’m trying to basic socket.io communication and i got a error as u see. Please share your solutions 😃 and i’m newbie so i copy paste codes please ignore them 😃

This is my 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 = 3000; server.listen(port, function () { console.log(‘Server listening at port %d’, port); }); io.on(‘connection’, function (socket) { io.sockets.emit(‘hey’, ‘hey i’m sent from server’); });

This is my index.html

var socket = io.connect('http://localhost:3000');
socket.on('hey', function(data){
   console.log(data);
});

And this is my file structure

  • public_html
    • node_modules
    • index.html
    • server.js

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
hienpham2tikicommented, Apr 7, 2017

@vainell Can you show your socket.io-client config ? If you try to access with public IP, make sure you config socket.io-client with this public ip too. For example: You public IP is 192.168.2.77 and you server is listening at port 8080 Your socket.io-client config should be var socket = io('http://192.168.2.77:8080');

0reactions
liyeruncommented, Nov 22, 2022

hello

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERR_CONNECTION_REFUSED | How to fix the error - IONOS
The ERR_CONNECTION_REFUSED error is a client-side problem that can be caused by incorrect firewall, system or browser settings, but also by ...
Read more >
ERR_CONNECTION_REFUSED: What It Is and 11 Ways to Fix It
11 Methods to Fix ERR_CONNECTION_REFUSED · 1. Check Whether the Website Is Down · 2. Restart Your Network Adapter · 3. Troubleshoot Internet...
Read more >
How to Fix the ERR_CONNECTION_REFUSED Error in Chrome
The ERR_CONNECTION_REFUSED error is sometimes caused by a server-side problem, rather than an issue with your individual attempt at connection.
Read more >
Error OPTIONS net::ERR_CONNECTION_REFUSED
This happens when the cross origin communication between the backend and frontend is not connected properly. Considering you have imported cors ...
Read more >
How to Fix ERR_CONNECTION_REFUSED Error in Chrome?
How to Fix ERR_CONNECTION_REFUSED Error in Chrome? · #1. Check the website status: · #2. Check your Internet/Wi-Fi Connection: · #3. Clear ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found