Mark
Mark

Reputation: 33551

node.js multi room chat example

I'm looking for a websocket/node.js chat implementation which supports multiple rooms.

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.

Upvotes: 68

Views: 48783

Answers (8)

Michael Moeller
Michael Moeller

Reputation: 906

tested and working great:

https://github.com/mmukhin/psitsmike_example_2

(node.js and socket.io multiroom chat tutorial with 17 stars on github)

Upvotes: 2

Matt Kneiser
Matt Kneiser

Reputation: 2146

Socket.io has support for rooms. This link helped me implement them in a matter of seconds.

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

Upvotes: 1

Shripad Krishna
Shripad Krishna

Reputation: 10498

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?

Upvotes: 6

Daniel Beardsley
Daniel Beardsley

Reputation: 20347

Wompt is an node.js multi-room chat server that was recently open-sourced.

Upvotes: 1

Mark
Mark

Reputation: 33551

http://github.com/maccman/juggernaut There's this one, only for ruby though.

Upvotes: 0

MKroehnert
MKroehnert

Reputation: 3737

There is this Gist available from Ryan Dahl the author of Node.JS which is a basic IRC daemon written in Node.JS. It is featured in this blog post which describes several IRC related Node.JS programs. Together with websocket this might be an alternative to try out.

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.

Upvotes: 1

Nikolaus Gradwohl
Nikolaus Gradwohl

Reputation: 20124

There is a really nice tutorial by laktek that shows how to use websockets with node.js. He has also a colaborative code editor that uses redis as a backend of a pub/sub service described here

Upvotes: 1

skrat
skrat

Reputation: 5562

You can take a look at http://orbited.org/ running STOMP protocol (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. I'm not sure how to get the list of channels, might be that you need to track these yourself.

Upvotes: 1

Related Questions