1
votes

Does subscribing to multiple PubNub channels share an HTTP connection or create separate connections?

The reason for asking is that clients will receive notifications from a central hub.

  • We can use channels for routing the notification types. (Like REST).
  • We can have a single channel for events, with an event_type field. (Like SOAP).

The former is preferable in terms of implementation simplicity, so just checking if there are any drawbacks.

2

2 Answers

2
votes

PubNub now offers Channel Groups and Wildcard Subscribe via the Stream Controller add-on

Channel Groups

PubNub now offers Channel Groups so that one client connection can subscribe to 20K channels at once (10 channel groups X 2000 channels in each channel group). See Channel Groups KBs for more details.

Wildcard Subscribe

Subscribe to a.b.* and publish to any channel that is prefixed by a.b. (a.b.c, a.b.d, a.b.aa, etc) and your a.b.* subscribe will get those messages. See Wildcard KBs for more details.

1
votes

PubNub Connections Per Channel

PubNub SDK client connections utilize one TCP connection per SDK instance. The number of channels used will not increase the open TCP connection count. Multiple PubNub channels share a connection. PubNub uses Multiplexing allowing your channel messages to be received using only one TCP connection.