socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

Error "Name not Resolved" when deployed to Electron

Open a-giovani17 opened this issue 11 years ago • 5 comments

Recenlty I tried to run my nodejs app with Electron as a desktop application. When I run my app, it shows error from socket.io like this:

GET http://file/socket.io/?EIO=3&transport=polling&t=1433386618495-6 net::ERR_NAME_NOT_RESOLVED

It seems that Electron couldn't find socket.io's essential files. How to solve it?

a-giovani17 avatar Jun 04 '15 03:06 a-giovani17

Did you set an url when creating a socket? socket.io-client uses window.localtion if you don't set specific url.

var socket = io('http://localhost');

nkzawa avatar Jun 04 '15 03:06 nkzawa

I created the socket like this:

var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); /* the socket */

where should I place the url (http://localhost) ?

a-giovani17 avatar Jun 04 '15 03:06 a-giovani17

I meant client side.

nkzawa avatar Jun 04 '15 03:06 nkzawa

I tried localhost & localhost:3000 but still get the error

GET http://localhost/socket.io/?EIO=3&transport=polling&t=1433389768914-8 net::ERR_NAME_NOT_RESOLVED

GET http://localhost:3000/socket.io/?EIO=3&transport=polling&t=1433389768914-8 net::ERR_NAME_NOT_RESOLVED

I use express framework

a-giovani17 avatar Jun 04 '15 03:06 a-giovani17

OK, it's solved. It is because the server isn't running. When I start the server, it works.

a-giovani17 avatar Jun 04 '15 05:06 a-giovani17