# Broadcast
The broadcast API family allows a broadcaster or admin authorized client to make broadcasts to viewers. Depending on the body and the authorization level, the broadcast endpoint family can send an arbitrary json object to a single viewer, a subset of viewers on a channel, all viewers on that channel, or all viewers that are currently using the extension.
Broadcasts are sandboxed by the Muxy JS SDK by stage - broadcasts sent to one API stage
(production, sandbox) by this endpoint will not trigger listen
s on other API stages.
JSON objects sent by Broadcast should be under 6kb in size. If the JSON object is larger than 4k, it will be automatically compressed, then base64d by the backend. If the resulting base64 string is longer than 4kb, then the broadcast will fail. This means that the effective maximum size of the JSON object sent by broadcast is not well defined, but 6kb is a safe size. Automatically compressed JSON data will be decoded and decompressed by the Muxy JS SDK transparently.
# Send Channel Broadcast
The broadcast
endpoint is the most generic of broadcast endpoints. It allows a backend
or admin
role
authorized user to send a message to any channel. When broadcast
is used as the target
, the message
will be sent to all viewers. If a targeted message is required, the target
should be set to
the string whisper-${user_id}
, where user_id
is the twitch user id of the viewer in question.
An application can only send 100 messages per five minute interval per channel.
# Endpoint
GET /v1/e/broadcast
# Authorization
Requires Authorization Header.
Must be backend
or admin
role.
# Request
{
"target": string,
"event": string,
"user_id": string,
"data": object
}
Name | Type | Description |
---|---|---|
target | string | Should be either broadcast or whisper-${user-id} . |
event | string | Arbitrary event string. The frontend should listen for this string. |
user_id | string | The channel to broadcast to. |
data | object | Arbitrary data object to broadcast. Should be under roughly 6kb of text data. |
# Response
{}
# Send Extension Broadcast
This endpoint will send an arbitrary json object to all viewers on all channels with the extension loaded.
# Endpoint
GET /v1/e/extension_broadcast
# Authorization
Requires Authorization Header
Must be backend
or admin
role. This authorization header must identify
either the owner or an administrator of the extension
# Request
{
"target": string,
"event": string,
"data": object
}
Name | Type | Description |
---|---|---|
event | string | Arbitrary event string. The frontend should listen for this string. |
data | object | Arbitrary data object to broadcast. Should be under roughly 6kb of text data. |
# Response
{}
# Whisper Self
This endpoint will send an arbitrary json object to the current viewer in the same channel that this request was made from. Generally, this endpoint is useful to send privileged events to the broadcaster configuration page when the broadcaster is interacting with the viewer extension.
# Endpoint
GET /v1/e/whisper_self
# Authorization
Requires Authorization Header
# Request
{
"event": string,
"data": object
}
Name | Type | Description |
---|---|---|
event | string | Arbitrary event string. The frontend should listen for this string. |
data | object | Arbitrary data object to broadcast. Should be under roughly 6kb of text data. |
# Response
{}