简体   繁体   中英

Deploying a python websockets server to ubuntu

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM