[英]How to create a chat usable from differents computers in node.js?
I am currently learning node.js and I've just finished the chat using socket.io and express.js which works well.我目前正在学习 node.js,我刚刚使用 socket.io 和 express.js 完成了聊天,效果很好。 But now I'd like to expand this chat so that two users from differents computers could communicate.但是现在我想扩展此聊天,以便来自不同计算机的两个用户可以进行通信。
I think it might be easier, first, using two computers on the same network but then I'd like the app to enable communication between two computers (each on a different network).我认为这可能更容易,首先,在同一网络上使用两台计算机,然后我希望该应用程序能够在两台计算机(每台计算机在不同的网络上)之间进行通信。
Is it possible using socket.io ?是否可以使用 socket.io ? If yes, how ?如果是,如何?
I guess there's something to change here :我想这里有一些改变:
server.listen(8080, function(){
console.log('listening on *:8080');
});
If someone knows how, please let me know !如果有人知道怎么做,请告诉我!
Thanks谢谢
You'll need to host your nodeJS application to a web server, giving everyone access to your website.您需要将 nodeJS 应用程序托管到 Web 服务器,让每个人都可以访问您的网站。
To achieve that you will need to use Cloud Application Platform, like AmazonWebService , or Heroku .为此,您需要使用云应用程序平台,例如AmazonWebService或Heroku 。 You will be able to host your nodeJS application to a server same as you do to develop but it will be online.您将能够将您的 nodeJS 应用程序托管到与您进行开发相同的服务器上,但它是在线的。
You could follow theses tutorials :您可以按照以下教程进行操作:
You can found more with this google search :您可以通过此 google 搜索找到更多信息:
"deploy node js app nginx" “部署节点js应用程序nginx”
Good luck.祝你好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.