logo
Video Call
Server API
Stream Mixing and Transcoding APIs
On this page

User Logged out Callback


Description

When developers need to know the number of users currently in the Room, they can be notified when users Logged out of the Room, and analyze it in combination with the User Logged in Callback.

Callback instructions

  • Request method: POST。
Note

The callback data format is JSON, you need to decode it with UrlDecode.

  • Request URL: Please configure the callback URL in the ZEGOCLOUD console.
  • Transfer protocol: HTTPS/HTTP, HTTPS is recommended.

Callback parameters

Common parametersTypeDescription
eventStringCallback event, this callback returns room_logout.
appidStringUnique identifier of the App.
timestampStringServer current time, Unix timestamp, unit: seconds.
nonceStringRandom number.
signatureStringVerification string, for details see Verification instructions.
Business parametersTypeDescription
room_idStringRoom ID.
room_seqString

Unique identifier of the Room lifecycle, remains unchanged during the entire lifecycle of the Room.
After the Room is created, a unique room_seq will be generated; if the Room is destroyed and then a new Room is created with the same room_id, a new unique room_seq will be generated.

This parameter is consistent with the parameter room_session_id in the Room created callback and Room destroyed callback.

user_accountStringUser ID of the user Logged in to the Room (userID used when the client logs in).
user_nicknameStringUsername of the user Logged in to the Room (userName used when the client logs in).
session_idStringUser session ID of the user Logged in to the Room.
login_timeStringServer current time when the user Logged in to the Room, Unix timestamp, unit: milliseconds.
logout_timeStringServer current time when the user Logged out of the Room, Unix timestamp, unit: milliseconds.
reasonString

Reason for the user to Logged out of the Room.

  • 0: Normal Logged out.
  • 1: Business layer heartbeat timeout.
  • 2: Access layer connection disconnected or heartbeat timeout.
  • 3: Kicked out by calling the backend interface.
  • 4: Token expired Logged out.
user_roleString

User role of the user Logged in to the Room.

  • 1: Host.
  • 2: Audience.
  • 4: Admin, this type of user mainly exists in scenarios such as cloud Recording and audio/video stream moderation. Client SDK user-related interfaces will filter this type of user.

This return parameter is only meaningful when integrating LiveRoom SDK. Please ignore this parameter when integrating Express SDK.

user_update_seqStringRoom user list change seq, increments by 1 when a user Logged in or Logged out.
Note

It is recommended to convert some parameters to Int for logical processing. Related fields include appid, login_time, logout_time , reason, room_seq, session_id, timestamp, user_role, and user_update_seq.

Data example

{
    "event": "room_logout",
    "appid": "1",
    "timestamp": "1499676978",
    "nonce": "350176",
    "signature": "signature",
    "room_id": "rid_1242649",
    "room_seq": "6085791336856668982",
    "user_account": "888120154",
    "user_nickname": "888120154",
    "session_id": "792462300429684736",
    "login_time": "1663740623660",
    "logout_time": "1663740627986",
    "reason": "0",
    "user_role": "1",
    "user_update_seq": "13"
}

Return response

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

Callback retry strategy

If ZEGOCLOUD server does not receive a response, or the received HTTP status code is not 2XX (e.g. 200), it will try to retry, up to 5 retries. The interval between each retry request and the previous request is 2s, 4s, 8s, 16s, 32s respectively. If the 5th retry still fails, no more retries will be made and the callback will be lost.

Previous

User Logged in Callback

Next

Stream Created Callback

On this page

Back to top