Conduit
Represents a Conduit connection.
Extends
Constructors
new Conduit()
Builds up a new Conduit.
Parameters
Parameter | Type | Description |
---|---|---|
options | ConduitOptions | The options of the conduit. |
Returns
Overrides
Source
twitchfy/packages/eventsub/src/structures/Conduit.ts:62
Properties
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
clientId | readonly | string | The client ID of the connection. | BaseConnection .clientId |
clientSecret | readonly | string | The client secret of the connection. | BaseConnection .clientSecret |
conduitCleanup | readonly | boolean | Whether to cleanup the conduit shards at start avoiding duplicate shards. Default is true. | - |
debug | public | boolean | Whether the connection is in debug mode or not. | BaseConnection .debug |
deleteConduitOnNoShards | readonly | boolean | Whether to delete the conduit when you are going to delete the last shard of the conduit. Default is false. | - |
dropSubsAtStart | readonly | boolean | Whether drop all subscriptions of the current conduit at start or not. Default is false. | - |
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 |
shards | readonly | Map <string , Shard > | The shards of the conduit. | - |
storage | readonly | StorageAdapter <Conduit > | The storage adapter used by the connection for storing subscriptions. | BaseConnection .storage |
subscriptions | readonly | SubscriptionCollection <Conduit , SubscriptionTypes > | The subscriptions of the connection. You will only receive events for this subscriptions. | BaseConnection .subscriptions |
workers | readonly | Map <string , Worker > | The workers of the conduit. | - |
Accessors
appToken
The app token used to manage the conduit and its subscriptions.
Returns
TokenAdapter
<"app"
, boolean
>
Source
twitchfy/packages/eventsub/src/structures/Conduit.ts:86
id
The id of the conduit.
Returns
string
Source
twitchfy/packages/eventsub/src/structures/Conduit.ts:93
shardCount
The number of shards of the conduit created by this process. This number is not synchronized with the API.
Returns
number
Source
twitchfy/packages/eventsub/src/structures/Conduit.ts:100
Methods
addListener()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof ConduitEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : ConduitEvents [K ]) => void |
Returns
this
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:7
addShard()
Adds a shard to the conduit.
Parameters
Parameter | Type |
---|---|
shard | string |
Returns
Promise
<void
>
Source
twitchfy/packages/eventsub/src/structures/Conduit.ts:339
deleteShard()
Deletes a shard of a conduit. This operation is not recommended as it could result in an error unless all the shards of the conduit are being created within the same process.
Parameters
Parameter | Type |
---|---|
shardId | string |
Returns
Promise
<Shard
[]>
Source
twitchfy/packages/eventsub/src/structures/Conduit.ts:270
emit()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof ConduitEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
…args | K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : ConduitEvents [K ] |
Returns
boolean
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:17
eventNames()
Returns
(keyof AsyncEventEmitterPredefinedEvents | keyof ConduitEvents)[]
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 ConduitEvents |
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 ConduitEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
Returns
(…args
:
| [Conduit
]
| [ConduitSubscription
<SubscriptionTypes
>]
| [SubscriptionMessage
<Conduit
>, ConduitSubscription
<SubscriptionTypes
>]
| [ConduitSubscription
<SubscriptionTypes
>]
| [Conduit
, Shard
]) => 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 ConduitEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : ConduitEvents [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 ConduitEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : ConduitEvents [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 ConduitEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : ConduitEvents [K ]) => void |
Returns
this
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:9
prependListener()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof ConduitEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : ConduitEvents [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 ConduitEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : ConduitEvents [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 ConduitEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
Returns
Listener
<
| [Conduit
]
| [ConduitSubscription
<SubscriptionTypes
>]
| [SubscriptionMessage
<Conduit
>, ConduitSubscription
<SubscriptionTypes
>]
| [ConduitSubscription
<SubscriptionTypes
>]
| [Conduit
, Shard
]>[]
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 ConduitEvents |
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 ConduitEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : ConduitEvents [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 conduit.
Parameters
Parameter | Type | Description |
---|---|---|
appToken | TokenAdapter <"app" , true > | The new app token. |
Returns
The conduit.
Source
twitchfy/packages/eventsub/src/structures/Conduit.ts:358
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 conduit and all the shards in the Conduit’s options. The promise will resolve when all the shards are fully enabled within the API.
Returns
Promise
<void
>
Source
twitchfy/packages/eventsub/src/structures/Conduit.ts:108
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
<ConduitSubscription
<T
>>
Overrides
Source
twitchfy/packages/eventsub/src/structures/Conduit.ts:112
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
<ConduitSubscription
<T
>[]>
Overrides
Source
twitchfy/packages/eventsub/src/structures/Conduit.ts:136
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