Constructor
new TwitchPubSub(config)
- Source:
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object
|
The config object.
|
Methods
connect() → {Promise}
Connects to the Twitch PubSub
- Source:
Returns:
- Type:
-
Promise
Promise for the connection.
disconnect() → {Promise}
Disconnects to the Twitch PubSub
- Source:
Returns:
- Type:
-
Promise
Promise for the disconnection.
reconnect() → {Promise}
Reconnect to WebSub and resubscribe to the already added topics.
- Source:
Returns:
- Type:
-
Promise
subscribe(types, id, authToken) → {Promise}
Subscribe to a topic based on the type.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
types |
Array.<String>
|
The types array. Valid options: 'bits', 'subscription', 'commerce', 'whisper' |
id |
String
|
The channel/user ID. |
authToken |
String
|
The oauth token with the necessary scopes. |
Returns:
- Type:
-
Promise
The subscription promise that will be resolved when it receives the response.