ConduitSubscription
A subscription created within a Conduit.
Extends
Subscription
<T
>
Type parameters
Type parameter |
---|
T extends SubscriptionTypes |
Constructors
new ConduitSubscription()
Builds up a ConduitSubscription.
Parameters
Parameter | Type | Description |
---|---|---|
conduit | Conduit | The Conduit that created this subscription. |
options | SubscriptionOptions <T > | The options for the subscription. |
data | PostEventSubSubscription | The data from the API. |
Returns
Overrides
Source
twitchfy/packages/eventsub/src/structures/ConduitSubscription.ts:30
Properties
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
callbacks | readonly | ConduitSubscriptionCallbackManager <T > | The callback manager for this subscription. | - |
conduit | readonly | Conduit | The Conduit that created this subscription. | - |
cost | readonly | number | The cost of the subscription. If the subscription doesn’t needs an authorization this could be 1 (or 0 if the target user has authorized within your application) if not it will be 0. Maximum accumulated cost for webhooks subscriptions is 10000 while for websocket subscriptions is 3. | Subscription .cost |
createdAt | readonly | Date | The date when the subscription was created. | Subscription .createdAt |
id | readonly | string | The ID of the subscription. | Subscription .id |
nonce | public | string | The nonce of the subscription. An unique identifier which you can set to separate same type subscriptions. | Subscription .nonce |
options | readonly | SubscriptionTypeOptions [T ] | The options used to create the subscription. | Subscription .options |
status | public | string | The status of the subscription. Normally is ‘enabled’. | Subscription .status |
type | readonly | T | The type of the subscription. | Subscription .type |
version | readonly | string | The version of the subscription. This version is the latest version of the subscription type. | Subscription .version |
Methods
checkSubscriptionType()
Checks if the subscription is of a certain type.
Type parameters
Type parameter |
---|
U extends SubscriptionTypes |
Parameters
Parameter | Type | Description |
---|---|---|
type | U | The type to check. |
Returns
this is ConduitSubscription<U>
Whether the subscription is of the type.
Source
twitchfy/packages/eventsub/src/structures/ConduitSubscription.ts:57
delete()
Deletes the subscription.
Returns
Promise
<void
>
Source
twitchfy/packages/eventsub/src/structures/ConduitSubscription.ts:65
onMessage()
Adds a callback to the subscription, which will be executed when a message of this subscription is received.
Parameters
Parameter | Type | Description |
---|---|---|
callback | ConduitSubscriptionCallback <T > |
Returns
void
Source
twitchfy/packages/eventsub/src/structures/ConduitSubscription.ts:46