Socket topic subscription overhead

You can’t subscribe in UserSocket.connect since it’s in the transport process. To get what you want, have a UserChannel with topic user:[user_id]. You could then multiplex conversations by subscribing the channel join to conversation:[convo_id]

Subscriptions are ets entries, so they are very cheap. Additionally, we pool the pubsub servers, so the underlying genserver call for subscribe is pooled.

3 Likes