Search code examples
node.jswebsocketovh

How do I upload a WebSocket-based Node.js project to my website?


The question is really as simple as that. I own a .com domain which I bought on OVH (pretty standard stuff—100GB of free space, PHP support, etc.): now, I installed Node.js on my computer and it works just fine, to the point I managed to use WebSocket to create an interactive HTML page that can be accessed via different tabs on my browser and that can be edited by multiple users at the same time.

However, all of this only works on localhost. If I upload the files to my website, I can still do the multiple tabs trick from my computer but my friends who try accessing the link can't see anything, and this error is displayed instead:

Uncaught DOMException: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.
    at HTMLButtonElement.<anonymous> ([LINK TO MY WEBSITE]:53:16)
(index):22 WebSocket connection to 'ws://localhost:9090/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
(anonymous) @ (index):22
3(index):42 WebSocket is already in CLOSING or CLOSED state.

I assume the problem is that Node.js is on my computer but it's not on my website. So how do I put it there?


Solution

  • If you have ordered a shared web hosting plan on OVH : it doesn't support Node.JS. Only PHP.

    If you have ordered a Virtual Private Server (VPS) or Dedicated Server, you'll have to install everything by yourself which will end up by you having more issues than solution based on what you are already asking.

    You should get in touch with OVH and try to get a refund and find an hosting solution that offer Node.JS.