Skip to content

ConduitSubscription

A subscription created within a Conduit.

Extends

Type parameters

Type parameter
T extends SubscriptionTypes

Constructors

new ConduitSubscription()

1
new ConduitSubscription<T>(
2
conduit: Conduit,
3
options: SubscriptionOptions<T>,
4
data: PostEventSubSubscription): ConduitSubscription<T>

Builds up a ConduitSubscription.

Parameters

ParameterTypeDescription
conduitConduitThe Conduit that created this subscription.
optionsSubscriptionOptions<T>The options for the subscription.
dataPostEventSubSubscriptionThe data from the API.

Returns

ConduitSubscription<T>

Overrides

Subscription.constructor

Source

twitchfy/packages/eventsub/src/structures/ConduitSubscription.ts:30

Properties

PropertyModifierTypeDescriptionInherited from
callbacksreadonlyConduitSubscriptionCallbackManager<T>The callback manager for this subscription.-
conduitreadonlyConduitThe Conduit that created this subscription.-
costreadonlynumberThe 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
createdAtreadonlyDateThe date when the subscription was created.Subscription.createdAt
idreadonlystringThe ID of the subscription.Subscription.id
noncepublicstringThe nonce of the subscription. An unique identifier which you can set to separate same type subscriptions.Subscription.nonce
optionsreadonlySubscriptionTypeOptions[T]The options used to create the subscription.Subscription.options
statuspublicstringThe status of the subscription. Normally is ‘enabled’.Subscription.status
typereadonlyTThe type of the subscription.Subscription.type
versionreadonlystringThe version of the subscription. This version is the latest version of the subscription type.Subscription.version

Methods

checkSubscriptionType()

1
checkSubscriptionType<U>(type: U): this is ConduitSubscription<U>

Checks if the subscription is of a certain type.

Type parameters

Type parameter
U extends SubscriptionTypes

Parameters

ParameterTypeDescription
typeUThe 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()

1
delete(): Promise<void>

Deletes the subscription.

Returns

Promise<void>

Source

twitchfy/packages/eventsub/src/structures/ConduitSubscription.ts:65


onMessage()

1
onMessage(callback: ConduitSubscriptionCallback<T>): void

Adds a callback to the subscription, which will be executed when a message of this subscription is received.

Parameters

ParameterTypeDescription
callbackConduitSubscriptionCallback<T>

Returns

void

Source

twitchfy/packages/eventsub/src/structures/ConduitSubscription.ts:46