Post event
This endpoint enables you to publish an event to a specific channel in a room. This event will be broadcast to all the clients that are subscribed to the channel in the room.
How to use
You can use the following cURL to obtain a response from this endpoint:
curl --request POST \
--url https://api.superviz.com/realtime/{room}/{channel}/publish \
--header "client_id: ${YOUR CLIENT_ID}" \
--header "secret: ${YOUR SECRET}" \
--data '{
"name": "event.name",
"data": {
"hello": "world!"
}
}'
HTTP Request
POST /realtime/{room}/{channel}/publish
In the request, you will need to send in the path following field:
Name | Description |
---|---|
room | Required. The ID of the room. |
channel | Required. The name of the channel you want to publish the event to. |
Headers
When using this endpoint, you need to provide the API Key. The following headers are required:
Name | Description |
---|---|
client_id | Required. You need to use the Client ID to authenticate in this repository. You can retrieve your Client ID under the Dashboard > Developer > Keys. |
secret | Required. You need to use the Secret Key to authenticate in this repository. You can create a new API Secret under our Dashboard > Developer > Keys. |
Request Body
The request body should contain the following fields:
Name | Type | Description |
---|---|---|
name | string | Required. The name of the event you want to publish. |
data | object | Required. The data payload of the event you want to publish. |
Example:
{
"name": "event.name",
"data": {
...
}
}
Response
Status code 200 will indicate that the request was successful and the message was published.