socketstream/socketstream — Issue #157: Use socket.io namespaces and/or rooms for PubSub
Author: nponeccop
Created: 2012-02-25 17:47:36+00:00
State: open

We are finally ready to check the PubSub facilities of SocketStream, so here is our use case.

Think of TV channels. There are free channels and pay channels. Each user is either a subscriber or a non-subscriber. Subscribers can watch any channels and non-subscribers can watch only free channels.

A user can watch any number of channels. As data volume is high, a user physically receives over websocket only the channels he is watching, not all channels he can watch. If user's subscriptions expires when he is watching a paid channel, the channel is disconnected immediately.

Client performs 2 requests: `ss.rpc('tv.start_watching', channel_name, cb)` and `ss.rpc('tv.stop_watching', channel_name, cb)`.

Server has a component that sends data for every channel every second, and knows nothing about clients.

Another server component handles start_watching and stop_watching requests from clients, routes the data to appropriate clients and disconnects clients from paid channels when their subscription expires.

Are there any components in Socketstream to do the routing task? If no, where should I start to implement them?

Does socketstream use namespaces or rooms of socket.io (see https://github.com/LearnBoost/socket.io for docs) for anything?