Ashif
Ashif

Reputation: 1684

Node.js chat server running on "cloud9-ide" is listening but not able to connect using client

Chat server is listening to the port, below snippet is from console log.

Your code is running at https://mynodetest-someone.c9.io.
Important: use process.env.PORT as the port and process.env.IP as the host in your scripts!

debugger listening on port 15454
   info  - socket.io started
Chat server listening at 0.0.0.0:4000

When trying to connect through browser: eg: "localhost:4000", connection is refused(Error code: ERR_CONNECTION_REFUSED)

Can some one help how to fix this issue?.

Note: I have tried listening on "127.0.0.1" and given original IP address in the network.

Upvotes: 1

Views: 1087

Answers (1)

Catalin MUNTEANU
Catalin MUNTEANU

Reputation: 5634

You can access the server using the URL that cloud9 provides for that specific server/project.

Use process.env.PORT as the port and process.env.IP as the host for you application and access your app using your project name - username. Should be something like https://mynodetest-someone.c9.io.

From the c9 page:

Important: use process.env.PORT as the port and process.env.IP as the host in your scripts!

Upvotes: 2

Related Questions