socket.io 1.0 error: ERR_NAME_NOT_RESOLVED -


I have a node using socket.io. This idea is a JS server, allows two different HTML files to communicate with each other through this server. All were well with socket. Now, I get some errors on both the client and the server side, the most obvious (for me, since I'm new to this) is the ERR_NAME_NOT_RESOLVED error that I started locally hosted server.js file and client HTML Connect it through.

When I open the console in Google Chrome, I get this error which prints every other or related console:

  GET Http: // file /socket.io/?iio = 2 & amp; Transport = voting & amp; T = 1406247171961-0 net :: ERR_NAME_NOT_RESOLVED   

The snippets of those places are as follows, where I may have problems in my html and server.js files as well as in a JS file that my HTML file is used to connect to the server.

index.html

I think this bit of code gets the socket.io client code from the localhost server. This is the first place where I feel I have a problem

  & lt; Script src = "http: // localhost: 4000 / socket.io / socket.io js" & gt; & Lt; / Script & gt; In addition, the following is where I am importing my index.js file which is used to connect to the server    

Pre> & lt; Script type = "text / javascript" src = "scriptsTeacher.js" & gt; & Lt; / Script & gt;

-

server.js

Setting this code (according to my sources) A server on the local host with Port 4000, in which customers can connect and receive / receive information

  var io; Io = Required ('socket.io'). Listen (4000); Io.on ('connection', function (socket) {console.log ("user connect");});   

-

index.js

This code is used by index.html which That it connects to a server listening on port 4000 using socket.io.

  var socket = io.connect ('localhost: 4000');   

-

- Currently, there are two random errors that I can find that are probably not the root cause of the problem, but my limited debugging experience can take me. ERR_NAME_NOT_RESOLVED: (Note: I saw and it was not completely useful because the user's use of http: /), As mentioned earlier, when I open index.html in Google Chrome and reach the console, I get several ERR_NAME_NOT_RESOLVED errors.

  • You are not welcome in the message "socket.io" when reaching the localhost: 4000 I'm sure that such a message should be There is no 404 error, when I start the server, I can use that webpage, but it is empty. If the server is not running, then I get a "webpage not found" message.

    My question is: Is there nothing that I am not doing but should? As I said, I'm new to this, and after some prey on the internet, I suspect that there are some servers (HTTP, Express, Express 3/4?) That I'm not setting though, it paid attention It goes that the code works in 9.96 (using functions () and .listen () which was removed from ver1.0 for migration). If there is any such information that is missing, then I will try my best to provide it as soon as possible.

    -

    I am using:
    Macintosh OS 10.6.8
    Google Chrome version 36.0.1985.125
    socket.io ver1.0
    Node.js v0.10.29

    The address in the error is incorrect (assuming you installed the local name resolver have not done it).

    The address starts with an error:

      file   

    when something like this should start with: < The pre- localhost: 4000

    The problem is probably in some js-config files for the web application (not the server). Or you might be trying to access the file locally instead of typing localhost: 4000 (e.g., open the html-file in the browser).

  • Comments

    Popular posts from this blog

    ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

    Matlab transpose a table vector -

    c# - Textbox not clickable but editable -