- Documentation
- RoomKit
- Server APIs
- RoomKit Server APIs
- Event callbacks
- Server event callbacks
Server event callbacks
1 Description
When certain events occur, the RoomKit server can send out event notifications through callbacks to your app server, so that your app server can handle them accordingly.
To set up a callback, you need to provide the "callback endpoint" and "encryption parameter" for accessing your app server. If your app server returns status 200, the callback is deemed successful; otherwise, the RoomKit server retries the callback—twice by default (the first one at 1 second later and the second one 5 seconds later).
Your app server must respond to the callback within 5 seconds; otherwise, it is treated as a timeout.
For details about how to use server event callbacks, see Use server event callbacks.
2 Event definition
2.1 Room events
Event type | Event description | Triggerring condition |
---|---|---|
1 | Room Ended |
|
2 | Participant Joined | When a user joins the room. |
3 | Participant Left |
|
4 | Room Started | The room is started by the host. |
5 | Participant Removed | The host or assistant removes a participant from room. |
6 | Room Suspended | The Roomkit backend will suspend the room if no one is online for 30 minutes. "Suspend the room" does not mean to end the room. |
7 | Room Mode Changed | Change Room Mode:
|
The following diagram shows when each of the event callbacks is triggered in a typical business process:
2.1.1 Room Ended
Message body of the event notification:
Parameter | Type | Description |
---|---|---|
event_type | Int | Event type. |
room_id | String | Room ID. |
timestamp | Int64 | Timestamp, in milliseconds. |
Message example:
{
"event_type": 1,
"room_id": "19827033659",
"timestamp": 1614149165898
}
2.1.2 Participant Joined
Message body of the event notification:
Parameter | Type | Description |
---|---|---|
event_type | Int | Event type. |
room_id | String | Room ID. |
timestamp | Int64 | Timestamp, in milliseconds. |
uid | Int64 | User ID. |
nickname | String | User nickname. |
role | Int | User role:
|
Message example:
{
"event_type": 2,
"nickname": "WeChat",
"role": 2,
"room_id": "19826903716",
"timestamp": 1614149159658,
"uid": 32614149156788
}
2.1.3 Participant Left
Message body of the event notification:
Parameter | Type | Description |
---|---|---|
event_type | Int | Event type. |
room_id | String | Room ID. |
timestamp | Int64 | Timestamp, in milliseconds. |
uid | Int64 | User ID. |
nickname | String | User nickname. |
role | Int | User role:
|
Message example:
{
"event_type": 3,
"nickname": "Google",
"role": 2,
"room_id": "19826903716",
"timestamp": 1614149175582,
"uid": 32614149031156
}
2.1.4 Room Started
Message body of the event notification:
Parameter | Type | Description |
---|---|---|
event_type | Int | Event type. |
room_id | String | Room ID. |
timestamp | Int64 | Timestamp, in milliseconds. |
Message example:
{
"event_type": 4,
"room_id": "19827033659",
"timestamp": 1614149165898
}
2.1.5 Participant Removed
Message body of the event notification:
Parameter | Type | Description |
---|---|---|
event_type | Int | Event type. |
room_id | String | Room ID. |
timestamp | Int64 | Timestamp, in milliseconds. |
uid | Int64 | User ID. |
nickname | String | User nickname. |
role | Int | User role:
|
Message example:
{
"event_type": 5,
"nickname": "Google",
"role": 2,
"room_id": "19826903716",
"timestamp": 1614149175582,
"uid": 32614149031156
}
2.1.6 Room Suspended
Message body of the event notification:
Parameter | Type | Description |
---|---|---|
event_type | Int | Event type. |
room_id | String | Room ID. |
timestamp | Int64 | Timestamp, in milliseconds. |
Message example:
{
"event_type": 6,
"room_id": "19826903716",
"timestamp": 1614149175582
}
2.1.7 Room Mode Changed
Message body of the event notification:
Parameter | Type | Description |
---|---|---|
event_type | Int | Event type. |
room_id | String | Room ID. |
timestamp | Int64 | Timestamp, in milliseconds. |
room_mode | Int | Changed room mode:
|
Message example:
{
"event_type": 7,
"room_id": "19826903716",
"timestamp": 1614149175582,
"room_mode": 2
}
2.2 Whiteboard events
Event type | Event description | Triggerring condition |
---|---|---|
101 | Whiteboard ID Changed |
|
2.2.1 Whiteboard ID Changed
Message body of the event notification:
Parameters | Type | Description |
---|---|---|
event_type | Int | Event type. |
room_id | String | Room ID. |
timestamp | Int64 | Timestamp, in milliseconds. |
whiteboard_id | String | Whiteboard ID. |
Message example:
{
"event_type": 101,
"room_id": "20082191900",
"timestamp": 1617786314436,
"whiteboard_id": "1438507235"
}