App Running on Digital Ocean Needs to Accept Websocket connections from clients

Posted December 20, 2015 8.6k views
NginxUbuntuGetting StartedNetworkingDeployment


I just created an Ubuntu-14.04 droplet on digital ocean.
I then deployed an application that used to previously run on my desktop.
On my test laptop the App was running on localhost. Client used to open websocket connections to localhost.

Now I have deployed app to DigitalOcean Droplet and would like client to connect to App using the same method.
I have verified that my application runs on Digital Ocean but does not accept incoming connections.

My question(s):

  1. What are the minimum components that I need to install on my droplet ?
    – Deploy App (yes)
    – HTTP server/Load Balancer (?? not sure)
    – What else is needed ??

  2. What URL should my client use if I need to connect to my App running on the DigialOcean droplet ?

  3. Does my Client need to use secure websockets to make sure that it gets to my App ? I would initially like to use ordinary websockets (not secure) to begin with and switch to secure websockets when development has progressed enough.
    Basically I want to address all security concernes at a later time after basic application is running.

Any pointers or information to my above 3 questions will be highly appreciated.

Thank you.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

1. You could set up Nginx as a websocket proxy.
Be sure to set the appropriate HTTP headers:

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

2. The URL depends on your proxy setup, if there is nothing else on port 80, you can just use the IP of your Droplet, or whatever domain (or subdomain) you have delegated to that IP address.

3. SSL is not necessary as far as I know.