Documentation
Server_APIs_v2 Server APIs v2
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • Server APIs v2
  • Server callbacks
  • Callback on room ended

Callback on room ended

Last updated:2023-04-17 18:30

1 Description

When you need to understand the relevant information of a room closure, you can obtain it through this callback.

2 Callback request

  • Request method: POST
    The callback data format is JSON, and you need to perform UrlDecode decoding on it.
  • Request endpoint: The corresponding callback endpoint in the ZEGOCLOUD Admin Console. (Click here to learn how to config the callback endpoint)
  • Transmission protocol: HTTPS/HTTP (HTTPS is recommended).

3 Request parameters

Public parameter Type Description
event
String
The callback event, and the returned value of this callback is room_close.
appid
Int
The unique identifier of the APP.
timestamp
Int
The current server time in Unix timestamp format, in seconds.
nonce
String
A random string.
signature
String
The verification string, see Authenticating server-to-server callbacks for details.
Business parameter Type Description
room_id
String
The room ID.
room_session_id
Int
The unique identifier of the room's life cycle, which remains unchanged throughout the entire life cycle of the room.

This parameter is consistent with the parameter "room_seq" in the Login Room Callback and Logout Room Callback.

close_reason
Integer
The reason why the room is closed.

  • 0: Normal close.
  • 1: The last user in the room timed out, and the room was closed because there was no one in the room.
  • 2: The last user in the room disconnected, and the room was closed because there was no one in the room.
  • 3: The last user in the room was Kickout, and the room was closed because there was no one in the room.
room_close_time
String
The time when the room was closed, in milliseconds.

4 Sample request

  • POST/JSON
{
    "event": "room_close",
    "appid": 1,
    "timestamp": 1499676989,
    "nonce": "350176",
    "signature": "signature",
    "room_id": "rid_1242649",
    "room_session_id": 858012925204410400,
    "close_reason": 1,
    "room_close_time": "1499676989909"
}
  • POST/FORM
Array
(
    [event] => room_close
    [appid] => 1
    [timestamp] => 1499676989
    [nonce] => 350176
    [signature] => signature
    [room_id] => rid_1242649
    [room_session_id] => 858012925204410400
    [close_reason] => 1
    [room_close_time] => 1499676989909
)

5 Sample response

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

6 Retry mechanism

If the ZEGOCLOUD server does not receive a response, or the HTTP status code received by the ZEGOCLOUD server is not 2xx (such as 200), it will retry with intervals of 2s, 4s, 8s, 16s, and 32s respectively. If the retry still fails after an interval of 32s, it will no longer retry.

Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code