Server APIs v2
  • Server APIs overview
  • Accessing Server APIs
  • Room signaling
  • Stream mixing
  • Streaming moderation
  • Streaming control
  • Cloud recording
  • Server callbacks
  • Return codes
  • API testing

Callback on logged out room

Last updated:2022-05-24 10:13

1 Description

After you configures this callback for the specified project, this callback will be triggered when users log out the room.

When the ZEGOCLOUD server does not receive a response and the callback fails both retries, the callback may be lost.

2 Callback request

  • Request method: POST/JSON

    Note: JSON is the default format; You can also use FORM format, which will need to use urldecode for URL decoding.

  • Request url: Please contact ZEGOCLOUD technical support to configure the callback url.

  • Transport protocol: HTTPS

3 Request parameters

Parameter Type Description
user_account
String
User account ID.
user_nickname
String
User nickname.
session_id
String
User session ID.
room_id
String
Room ID.
room_seq
String
The unique identifier of the room's lifetime.
For example, the user's room_id is r1 for two logins, but the room_seq of the first login is 123, and the room_seq of the second login is 234. At this time, the room_seq (123) room can only be created after the room is destroyed. Although the room_id is the same, it is a different room.
logout_time
Int
User exit room timestamp, in milliseconds.
timestamp
Int
The current server time, Uinx timestamp.
nonce
String
Random number.
signature
String
reason
Int
logout reason.

  • 0: log out normally.
  • 1: Heartbeat timeout.
  • 2: The user network disconnected.
  • 3: Kicked out.
  • 4: The token expired.
appid
String
The unique Application ID assigned to your project by ZEGOCLOUD.
event
String
Callback event, the value in this callback is "room_logout".

4 Request data example

  • POST/JSON
{
    "user_account": "888120154",
    "user_nickname": "888120154",
    "user_role": 1,
    "session_id": "0",
    "room_id": "rid_1242649",
    "room_seq": "6085791336856668982",
    "logout_time": 1499676978027,
    "timestamp": 1499676978,
    "nonce": "350176",
    "signature": "signature",
    "reason": 0,
    "appid": "1",
    "event": "room_logout"
}
  • POST/FORM
Array
(
    [user_account] => 888120154
    [user_nickname] => 888120154
    [user_role] => 1
    [session_id] => 0
    [room_id] => rid_1242649
    [room_seq] => 6085791336856668982
    [logout_time] => 1499676978027
    [timestamp] => 1499676978
    [nonce] => 350176
    [signature] => signature
    [reason] => 0
    [appid] => 1
    [event] => room_logout
)

5 Response example

Returning an HTTP status code of 2XX (eg 200) indicates success, and other responses indicate failure.

6 Retry mechanism

If the HTTP request fails (i.e., the HTTP status code is not 2xx), the ZEGO server will retry the request after 15 seconds. If the retry still fails, no more retry will be attempted.