简体   繁体   English

node.js多房间聊天示例

[英]node.js multi room chat example

I'm looking for a websocket/node.js chat implementation which supports multiple rooms. 我正在寻找支持多个房间的websocket / node.js聊天实现。

I'm also going to write an app which needs multiple rooms or servers, and I'm just looking for some code samples of how people do it. 我也打算写一个需要多个房间或服务器的应用程序,我只是在寻找人们如何做的代码示例。

Thanks. 谢谢。

I know there's a service http://pusherapp.com which provides this service, but I'm looking for an open source example. 我知道有一个服务http://pusherapp.com提供这项服务,但我正在寻找一个开源示例。

I realized that you have not yet received a solution to your issue yet. 我意识到你还没有收到你的问题的解决方案。 Suggest looking at this question where i have provided the answer: 建议看看我提供答案的这个问题:

node-websocket-server: possible to have multiple, separate "broadcasts" for a single node.js process? node-websocket-server:可以为单个node.js进程提供多个独立的“广播”吗?

tested and working great: 测试和工作很好:

https://github.com/mmukhin/psitsmike_example_2 https://github.com/mmukhin/psitsmike_example_2

(node.js and socket.io multiroom chat tutorial with 17 stars on github) (在github上有17颗星的node.js和socket.io多房间聊天教程)

Wompt是最近开源的node.js多房间聊天服务器。

Socket.io has support for rooms. Socket.io支持房间。 This link helped me implement them in a matter of seconds. 这个链接帮助我在几秒钟内实现它们。

https://github.com/LearnBoost/socket.io/wiki/Rooms https://github.com/LearnBoost/socket.io/wiki/Rooms

You can take a look at http://orbited.org/ running STOMP protocol ( http://stomp.codehaus.org/Home ). 您可以查看http://orbited.org/运行STOMP协议( http://stomp.codehaus.org/Home )。 It has channel support (your rooms). 它有渠道支持(你的房间)。 So you just need to send some JSON encoded messages carrying user's nicknames to a channel. 所以你只需要将一些带有用户昵称的JSON编码消息发送到一个频道。 I'm not sure how to get the list of channels, might be that you need to track these yourself. 我不确定如何获取频道列表,可能是您需要自己跟踪这些频道。

There is a really nice tutorial by laktek that shows how to use websockets with node.js. laktek有一个非常好的教程,它展示了如何使用带有node.js的websockets。 He has also a colaborative code editor that uses redis as a backend of a pub/sub service described here 他还有一个协作代码编辑器,它使用redis作为这里描述的pub / sub服务的后端

There is this Gist available from Ryan Dahl the author of Node.JS which is a basic IRC daemon written in Node.JS. 这个Gist可以从Node.JS的作者Ryan Dahl获得,这是一个用Node.JS编写的基本IRC守护进程。 It is featured in this blog post which describes several IRC related Node.JS programs. 这篇博客文章介绍了几个与IRC相关的Node.JS程序。 Together with websocket this might be an alternative to try out. 与websocket一起,这可能是尝试的替代方案。

The webchat demo (http://chat.nodejs.org/) hosted on the Node.JS homepage is a complete example and the source code can be found in the following GitHub repository and is available under the MIT license. 在Node.JS主页上托管的网络聊天演示(http://chat.nodejs.org/)是一个完整的示例,源代码可以在以下GitHub存储库中找到,并且可以在MIT许可下使用。

http://github.com/maccman/juggernaut这是一个,但仅适用于红宝石。

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

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