简体   繁体   English

如何将基于 WebSocket 的 Node.js 项目上传到我的网站?

[英]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. 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创建一个交互式 HTML 页面,该页面可以通过浏览器上的不同选项卡访问,并且可以由多个用户同时编辑。

However, all of this only works on localhost.但是,所有这些仅适用于 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.我认为问题是 Node.js 在我的计算机上,但不在我的网站上。 So how do I put it there?那我怎么把它放在那里?

If you have ordered a shared web hosting plan on OVH: it doesn't support Node.JS .如果您在 OVH 上订购了共享的 web 托管计划:它不支持 Node.JS Only PHP .只有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.如果您订购了虚拟专用服务器 (VPS) 或专用服务器,则您必须自己安装所有东西,这最终会导致您遇到的问题多于基于您已经提出的解决方案的解决方案。

You should get in touch with OVH and try to get a refund and find an hosting solution that offer Node.JS.您应该联系 OVH 并尝试获得退款并找到提供 Node.JS 的托管解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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