Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
How do I setup my Ubuntu 18.04 server to allow for WebSockets?
I have an Ubuntu-18.04 server (which we will say has the hostname s1.myserver.com for the sake of ease) that was set up on DigitalOcean using these 2 tutorials (so you know what it have installed etc currently):
And then I’ve used these 2 tutorials for each new website/project on the server (for the vhosts and ssl):
I have a number of website based projects which use frequent AJAX requests which use a lot of the droplet/servers CPU which needs optimizing, so I looked for alternatives. In looking for ways to optimize this I discovered WebSockets. When I tested various examples that used the I found online locally using XAMPP I managed to get them to work, however when I tried the same code on my server I kept getting a variety of errors which led to me realize that my server probably doesn’t support WebSockets.
I’m new to server-side stuff currently so whilst I know that a lot of the tutorials I’ve read for things such as Nodejs and similar systems are the way to go, for what I’m trying to achieve I keep finding tutorials that are either way to basic to achieve my goal or assume way to much prior knowledge to help.
Alternatively if an different server type/configuration would be required to achieve this I’m happy to move the websites/projects to s2.myserver.com with said different setup.
Alternatively again I’m happy to simply have a second droplet for websockets alone (I have a lot of projects that I’d upgrade to using them if I can get it to work - so this wouldn’t be a bad system if that’s doable - I’d happily have the hypothetical s3.myserver.com be used for websockets alone).
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.×