0

I have an application that unitilizes the websockets library.

It's a server that listens on a specified port. I made an HTML/JS client for it. On my local machine everything runs fine. But I want to deploy the websockets application to my Ubuntu 14 VPS.

On the server I set up everything to run the application, I run it, but client's can't connect on specified port, they time out. According to the server logs the server doesn't receive any data from clients.

I have allowed tcp traffic throught the desired port via ufw.

The project can be found here (the server in question is in server.py).

What steps are required to make the client data reach the server application?

1 Answer 1

1

From a quick glance you seem to use localhost as server name in server.py and client.html.

That will cause the server to only accept connections on the loopback interface which won't be reachable over the internet, and the client to connect to your local machine instead of the server.

In your server.py you could use the empty string as hostname to bind to all interfaces, or the correct ip address to listen on.

In your client you need to use the domain name or ip address of the server.

Sign up to request clarification or add additional context in comments.

4 Comments

Nice catch. when I tried to run it I changed the host in client.html, but didn't change the host in server.py. I will try it and report on the results
I have changed host in server.py to an empty string, but nothing changed.
Also netstat -l shows that *:8765 is being listened on
It's hard to say, you should check for any error messages in the client (javascript log), and check that you can generally connect to that port (e.g. by using nc -v -l -p 8765 to listen on that port and check for incoming connections)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.