Private channels

Private channels should be used when access to the channel needs to be restricted in some way. In order for a user to subscribe to a private channel permission must be authorised. The authentication occurs via a HTTP Request to a configurable authentication url when the subscribe method is called with a private- channel name. In the JavaScript client library the HTTP Request is executed via AJAX (see Authenticating Users).

Private channels must be prefixed with `private-`. See channel naming conventions.

Private channel subscriptions must be authenticated. See Authenticating Users.

Subscribe

When a subscription takes place the user authentication process will be triggered.

var privateChannel = pusher.subscribe(privateChannelName);
  • privateChannelName (String)
    • The name of the channel to subscribe to. Since it is a private channel the name must be prefixed with private-
  • Returns
    • A Channel object which events can be bound to. See binding to events for more information on the Channel object.
PTPusherPrivateChannel *private = [_client subscribeToPrivateChannelNamed:privateChannelName];
  • privateChannelName (String)
    • The name of the channel to subscribe to. This method will add the appropriate private- prefix to the channel name for you.
  • Returns
    • a channel cast to the correct PTPusherChannel subclass PTPusherPrivateChannel which events can be bound to. See binding to events.

Unsubscribe

See unsubscribing from channels.

Events

See binding to events for general information about how to bind to events on a channel object.

You can bind to the following pusher: events on a private channel:

Have you tried using the search to find what you’re after? If you still have a question then get in touch with us and let us help you out.