WebhookConnection
A Webhook Connection.
Extends
Constructors
new WebhookConnection()
Builds up a new WebhookConnection.
Parameters
Parameter | Type | Description |
---|---|---|
options | WebhookConnectionOptions | The options for the connection. |
server ? | Express | The express server used for receiving Twitch data. |
Returns
Overrides
Source
twitchfy/packages/eventsub/src/webhook/structures/WebhookConnection.ts:62
Properties
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
baseURL | readonly | string | The base URL for the webhook callback. | - |
clientId | readonly | string | The client ID of the connection. | BaseConnection .clientId |
clientSecret | readonly | string | The client secret of the connection. | BaseConnection .clientSecret |
debug | public | boolean | Whether the connection is in debug mode or not. | BaseConnection .debug |
dropSubsAtStart | readonly | boolean | Whether to drop subscriptions at start. This will delete all subscriptions that are currently active within the client (only webhook created) to avoid duplicated subscriptions if any storage was set. | - |
helixClient | readonly | HelixClient | The Helix client used by the connection for making API Requests. | BaseConnection .helixClient |
logger | readonly | Logger | The logger of the connection. | BaseConnection .logger |
maintainSubscriptions | readonly | boolean | Whether the connection should maintain the subscriptions or not between each start. | BaseConnection .maintainSubscriptions |
secret | readonly | string | The secret used for creating subscriptions within this connection. | - |
server | readonly | Express | The express server used for receiving Twitch data. | - |
startServer | readonly | boolean | Whether to start the server when the connection is started. | - |
storage | readonly | StorageAdapter <WebhookConnection > | The storage adapter used by the connection for storing subscriptions. | BaseConnection .storage |
subscriptionRoute | readonly | string | The route for receiving Twitch messages. Default /subscriptions | - |
subscriptions | readonly | SubscriptionCollection <WebhookConnection , SubscriptionTypes > | The subscriptions of the connection. You will only receive events for this subscriptions. | BaseConnection .subscriptions |
Accessors
appToken
The app token used for the connection.
Returns
TokenAdapter
<"app"
, boolean
>
Source
twitchfy/packages/eventsub/src/webhook/structures/WebhookConnection.ts:168
url
The URL for the webhook callback. This is a join between the base url and the subscription route.
Returns
string
Source
twitchfy/packages/eventsub/src/webhook/structures/WebhookConnection.ts:86
Methods
addListener()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebhookEvents [K ]) => void |
Returns
this
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:7
emit()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
…args | K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebhookEvents [K ] |
Returns
boolean
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:17
eventNames()
Returns
(keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents)[]
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:21
getMaxListeners()
Returns
number
Inherited from
BaseConnection
.getMaxListeners
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:14
listenerCount()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
Returns
number
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:18
listeners()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
Returns
(…args
: [WebhookConnection
] | [WebhookSubscription
<SubscriptionTypes
>] | [SubscriptionMessage
<WebhookConnection
>, WebhookSubscription
<SubscriptionTypes
>] | [WebhookSubscription
<SubscriptionTypes
>]) => Awaitable
<void
>[]
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:15
makeDebug()
Makes a debug log
Parameters
Parameter | Type | Description |
---|---|---|
…args | any [] | The arguments to log. |
Returns
void
Inherited from
Source
twitchfy/packages/eventsub/src/structures/BaseConnection.ts:113
makeWarn()
Makes a warn log
Parameters
Parameter | Type | Description |
---|---|---|
…args | any [] | The arguments to log. |
Returns
void
Inherited from
Source
twitchfy/packages/eventsub/src/structures/BaseConnection.ts:124
off()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebhookEvents [K ]) => void |
Returns
this
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:11
on()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebhookEvents [K ]) => void |
Returns
this
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:8
once()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebhookEvents [K ]) => void |
Returns
this
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:9
post()
Used for handling incoming Twitch requests in your custom non-Express server.
Parameters
Parameter | Type | Description |
---|---|---|
headers | IncomingHttpHeaders | The headers of the request. |
body | any | The body of the request. |
verification | (challenge : string ) => any | A callback to be called when the request is a webhook callback verification and you need to send the challenge. |
success | () => any | A callback to be called when the handling has suceeded. You will need to send a 200 status in the response after that. |
invalidSignature ? | () => any | A callback which is executed when the signature that has been sent by the requester is incorrect. |
Returns
Promise
<any
>
Source
twitchfy/packages/eventsub/src/webhook/structures/WebhookConnection.ts:181
prependListener()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebhookEvents [K ]) => void |
Returns
this
Inherited from
BaseConnection
.prependListener
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:19
prependOnceListener()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebhookEvents [K ]) => void |
Returns
this
Inherited from
BaseConnection
.prependOnceListener
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:20
rawListeners()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
Returns
Listener
<[WebhookConnection
] | [WebhookSubscription
<SubscriptionTypes
>] | [SubscriptionMessage
<WebhookConnection
>, WebhookSubscription
<SubscriptionTypes
>] | [WebhookSubscription
<SubscriptionTypes
>]>[]
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:16
removeAllListeners()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents |
Parameters
Parameter | Type |
---|---|
event ? | K |
Returns
this
Inherited from
BaseConnection
.removeAllListeners
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:12
removeListener()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebhookEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebhookEvents [K ]) => void |
Returns
this
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:10
setAuth()
Sets a new app token for the connection.
Parameters
Parameter | Type | Description |
---|---|---|
appToken | TokenAdapter <"app" , boolean > | The new app token. |
Returns
The connection.
Source
twitchfy/packages/eventsub/src/webhook/structures/WebhookConnection.ts:158
setMaxListeners()
Parameters
Parameter | Type |
---|---|
n | number |
Returns
this
Inherited from
BaseConnection
.setMaxListeners
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:13
start()
Starts the Webhook Connection.
Parameters
Parameter | Type | Description |
---|---|---|
port ? | number | The port to start the server at if the startServer option is set to true. |
callback ? | () => void | A callback to be called when the server is started if the startServer option is set to true. |
Returns
Promise
<boolean
>
Source
twitchfy/packages/eventsub/src/webhook/structures/WebhookConnection.ts:143
subscribe()
Subscribe to an EventSub event.
Type parameters
Type parameter |
---|
T extends SubscriptionTypes |
Parameters
Parameter | Type | Description |
---|---|---|
options | SubscriptionOptions <T > | The options of the subscription. |
Returns
Promise
<WebhookSubscription
<T
>>
Overrides
Source
twitchfy/packages/eventsub/src/webhook/structures/WebhookConnection.ts:90
subscribeAll()
Subscribe to multiple EventSub events.
Type parameters
Type parameter |
---|
T extends SubscriptionTypes |
Parameters
Parameter | Type | Description |
---|---|---|
…options | SubscriptionOptions <T >[] | The options of the subscriptions. |
Returns
Promise
<WebhookSubscription
<T
>[]>
Overrides
Source
twitchfy/packages/eventsub/src/webhook/structures/WebhookConnection.ts:111
waitForAllListenersToComplete()
Returns
Promise
<boolean
>
Inherited from
BaseConnection
.waitForAllListenersToComplete
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:22
listenerCount()
Type parameters
Type parameter | Value |
---|---|
Emitter extends AsyncEventEmitter <any , any > | - |
EventNames | Emitter extends AsyncEventEmitter <Events , Events > ? Events : never |
EventName extends PropertyKey | EventNames extends never ? string | symbol : keyof EventNames |
Parameters
Parameter | Type |
---|---|
emitter | Emitter |
eventName | keyof AsyncEventEmitterPredefinedEvents | EventName |
Returns
number
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:25
on()
Type parameters
Type parameter | Value |
---|---|
Emitter extends AsyncEventEmitter <any , any > | - |
EventNames extends object | Emitter extends AsyncEventEmitter <Events , any > ? Events : Record <PropertyKey , unknown []> |
EventName extends PropertyKey | keyof AsyncEventEmitterPredefinedEvents | keyof EventNames |
EventResult extends unknown [] | EventNames extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [EventName ] : EventNames [EventName ] |
Parameters
Parameter | Type |
---|---|
emitter | Emitter |
eventName | EventName |
options ? | AbortableMethods |
Returns
AsyncGenerator
<EventResult
, void
, unknown
>
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:29
once()
Type parameters
Type parameter | Value |
---|---|
Emitter extends AsyncEventEmitter <any , any > | - |
EventNames extends object | Emitter extends AsyncEventEmitter <Events , any > ? Events : Record <PropertyKey , unknown []> |
EventName extends PropertyKey | keyof AsyncEventEmitterPredefinedEvents | keyof EventNames |
EventResult extends unknown [] | EventNames extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [EventName ] : EventNames [EventName ] |
Parameters
Parameter | Type |
---|---|
emitter | Emitter |
eventName | EventName |
options ? | AbortableMethods |
Returns
Promise
<EventResult
>
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:27