JavaScript REST SDK: PushChannel

The PushChannel object of an HTTP client lists the push subscriptions on a channel. Access it via channel.push.

To subscribe or unsubscribe a device or client ID from a server, use PushAdmin.channelSubscriptions.

JavaScript

1

const pushChannel = channel.push;

List subscriptions on this channel

pushChannel.listSubscriptions(params?: Record<string, string>): Promise<PaginatedResult<PushChannelSubscription>>

Lists push subscriptions on the channel by querying the REST API's list channel subscriptions endpoint. These subscriptions can be a list of client (clientId) subscriptions, device (deviceId) subscriptions, or a combination of both. This method requires clients to have the Push Admin capability.

JavaScript

1

const subscriptions = await channel.push.listSubscriptions({ deviceId: '<device-id>' });

Parameters

The listSubscriptions() method takes the following parameters:

paramsoptionalRecord<String, String>
An object containing key-value pairs to filter subscriptions by. Can contain clientId, deviceId, or a combination of both, and a limit on the number of subscriptions returned (up to 1,000).

Returns

Promise<PaginatedResult<PushChannelSubscription>>

Returns a promise. The promise is fulfilled with a PaginatedResult containing an array of PushChannelSubscription objects, which supports pagination using its next and first methods, or rejected with an ErrorInfo object.

channelString
The channel that this push notification subscription is associated with.
deviceIdString or Undefined
The device with this identifier is linked to this channel subscription. When present, clientId is never present.
clientIdString or Undefined
Devices with this client identifier are included in this channel subscription. When present, deviceId is never present.