WebSocketConnection
The WebSocket connection used for EventSub.
Extends
Constructors
new WebSocketConnection()
Builds up a new WebSocketConnection.
Parameters
Parameter | Type | Description |
---|---|---|
options | WebSocketConnectionOptions | The options for the connection. |
Returns
Overrides
Source
twitchfy/packages/eventsub/src/ws/structures/WebSocketConnection.ts:35
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 |
debug | public | boolean | Whether the connection is in debug mode or not. | BaseConnection .debug |
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 |
proxy? | readonly | string | The proxy url used for the connection. | - |
sessionId | public | string | The session id of the connection. | - |
storage | readonly | StorageAdapter <WebSocketConnection > | The storage adapter used by the connection for storing subscriptions. | BaseConnection .storage |
subscriptions | readonly | SubscriptionCollection <WebSocketConnection , SubscriptionTypes > | The subscriptions of the connection. You will only receive events for this subscriptions. | BaseConnection .subscriptions |
ws | public | WebSocket | The WebSocket client used for the connection. | - |
Accessors
userToken
Gets the user token that is being used for the connection.
Returns
UserTokenAdapter
<boolean
>
Source
twitchfy/packages/eventsub/src/ws/structures/WebSocketConnection.ts:123
Methods
addListener()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebSocketEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebSocketEvents [K ]) => void |
Returns
this
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:7
connect()
Connects to the WebSocket server.
Returns
Promise
<void
>
Source
twitchfy/packages/eventsub/src/ws/structures/WebSocketConnection.ts:54
emit()
Type parameters
Type parameter |
---|
K extends keyof AsyncEventEmitterPredefinedEvents | keyof WebSocketEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
…args | K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebSocketEvents [K ] |
Returns
boolean
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:17
eventNames()
Returns
(keyof AsyncEventEmitterPredefinedEvents | keyof WebSocketEvents)[]
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 WebSocketEvents |
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 WebSocketEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
Returns
(…args
:
| [WebSocketConnection
]
| [WebSocketConnection
, string
]
| [WebSocketSubscription
<SubscriptionTypes
>]
| [SubscriptionMessage
<WebSocketConnection
>, WebSocketSubscription
<SubscriptionTypes
>]
| [WebSocketSubscription
<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 WebSocketEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebSocketEvents [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 WebSocketEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebSocketEvents [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 WebSocketEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebSocketEvents [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 WebSocketEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebSocketEvents [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 WebSocketEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebSocketEvents [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 WebSocketEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
Returns
Listener
<
| [WebSocketConnection
]
| [WebSocketConnection
, string
]
| [WebSocketSubscription
<SubscriptionTypes
>]
| [SubscriptionMessage
<WebSocketConnection
>, WebSocketSubscription
<SubscriptionTypes
>]
| [WebSocketSubscription
<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 WebSocketEvents |
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 WebSocketEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents [K <K >] : WebSocketEvents [K ]) => void |
Returns
this
Inherited from
Source
twitchfy/node_modules/@vladfrangu/async_event_emitter/dist/index.d.ts:10
setAuth()
Sets the user token for the connection.
Parameters
Parameter | Type | Description |
---|---|---|
userToken | TokenAdapter <"implicit" | "code" , boolean > | The new user token to set. |
Returns
The connection.
Source
twitchfy/packages/eventsub/src/ws/structures/WebSocketConnection.ts:113
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
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
<WebSocketSubscription
<T
>>
Overrides
Source
twitchfy/packages/eventsub/src/ws/structures/WebSocketConnection.ts:60
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
<WebSocketSubscription
<T
>[]>
Overrides
Source
twitchfy/packages/eventsub/src/ws/structures/WebSocketConnection.ts:81
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