Reputation: 4652
I am a novice on Websocket programming, but my latest project required to deploy a WebSocket Server on Ubuntu Linux Server. I have read some from the internet, and know -
Based on what I knew, I think I can deploy Apache/Nginx and a Websocket Server together through 80/443. I am wondering, if we can just use the websocket server indepdently? I think if we can write a websocket client connecting to the server from other ports , then we can do it.
So can we write a websocket client to connect the server from different port ?
Upvotes: 6
Views: 11091
Reputation: 2740
Yes. A standalone WebSocket server can usually be run on any port. Browser clients have no problem opening WebSocket connections to servers on non HTTP(S) ports.
The primary reason that the default ports are 80/443 is that they are the most reliable ports for mass usage due to their ability to traverse many corporate firewalls that block all traffic on all other ports.
If this will not be a problem for your audience (or you have HTTP based fallbacks) it is perfectly reasonable (and a lot easier) to use alternate ports for the WebSocket servers. Another option is to use the 80/443 ports but on a separate IP address/hostname.
Upvotes: 5