net::ERR_CONNECTION_REFUSED
See original GitHub issueHey 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:
- Created 8 years ago
- Comments:11 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 bevar socket = io('http://192.168.2.77:8080');
hello