building a net of socket.io servers

273 views
Skip to first unread message

Toni Wagner

unread,
Mar 7, 2012, 2:10:59 PM3/7/12
to sock...@googlegroups.com
Hi,
i am looking for an elegant way to scale socket.io across servers. I have an app based on nodeJS and socket.io and i need connected clients to dynamically talk to one-another.
my communication system creates independent rooms for single users, and usergroups (clients only talk to one another in usergroup-rooms). 
Obviously, we will have multiple servers, but I do not want to use the database to sync client<->client interactions. hence, i have to somehow link/sync multiple socket.io servers.

now my question is: 
is there an easy way (or already present open source project) that makes socket.io servers join rooms on other servers and 'syncs' their messages to own clients?
or in other words: 
can i spread ONE ROOM across multiple independent socket.io servers ?
or:
is there a more clever way to scale socket.io that i'm missing?

in any case, tnx for the terrific work with socket.io!!
Toni

Marak Squires

unread,
Mar 7, 2012, 2:38:23 PM3/7/12
to sock...@googlegroups.com
I use hook.io for stuff like this, maybe it can help.

--
-- 
Marak Squires
Co-founder and Chief Evangelist
Nodejitsu, Inc.

derek buchner

unread,
Mar 8, 2012, 9:28:11 AM3/8/12
to sock...@googlegroups.com
I've been routing the messages via Redis' pubsub. Basically, the socket servers subscribe to the channels in which the connections/clients have requested membership in. When a message arrives, you publish on that room. The socket servers then pick up the message and emit to those in the target room.

The module was node_redis, "npm install redis".

Derek

Toni Wagner

unread,
Mar 9, 2012, 6:00:07 AM3/9/12
to sock...@googlegroups.com
great, thanks guys! I will look into both suggestions over the weekend. Still, i am a bit surprised that there is no 'native' solution for the general problem of scaling socket.io across server instances  from the socket.io team / community.

I am considering to start such a project, maybe based on your suggestions..

cheers,
t



2012/3/8 derek buchner <dlbu...@gmail.com>



--
Dr. Toni Wagner
- CEO/Geschäftsführer -

ViSERiON UG (haftungsbeschränkt)
Friedrich-Bergius-Ring 15
97076 Würzburg, Germany


Geschäftsführer:
Dr. Toni Wagner

Registergericht: AG Würzburg HRB 11239

Disclaimer
This message is intended for the addressee(s) only and may contain
confidential information. We do not waive confidentiality or other
rights by mistransmission.  If you have received this communication in
error, any use, dissemination, printing or copying is strictly
prohibited; please destroy all electronic and paper copies and notify
the sender immediately.  Please note that the firm or its General
Partners may be directly or indirectly invested in companies discussed
in this message. Except in case of gross negligence or wilful
misconduct we accept no liability for any loss or damage caused by
software or e-mail viruses. 

Marak Squires

unread,
Mar 9, 2012, 9:00:24 AM3/9/12
to sock...@googlegroups.com
Like I said, hook.io does this.
Reply all
Reply to author
Forward
0 new messages