User Logged in Callback
Description
When developers need to know information about users currently in a Room, they can receive the "User Logged in Callback" and analyze it in combination with the User Logged out Callback.
Callback instructions
- Request method: POST。
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 parameters | Type | Description |
|---|---|---|
| event | String | Callback event, this callback returns room_login. |
| appid | String | Unique identifier of the App. |
| timestamp | String | Server current time, Unix timestamp, unit: seconds. |
| nonce | String | Random number. |
| signature | String | Verification string, for details see Verification instructions. |
| Business parameters | Type | Description |
| room_id | String | Room ID. |
| room_name | String | Room name. |
| room_seq | String | Unique identifier of the Room lifecycle, remains unchanged during the entire lifecycle of the Room. This parameter is consistent with the parameter room_session_id in the Room created callback and Room destroyed callback. |
| user_account | String | User ID of the user Logged in to the Room (userID used when the client logs in). |
| user_nickname | String | Username of the user Logged in to the Room (userName used when the client logs in). |
| session_id | String | User session ID of the user Logged in to the Room. |
| login_time | String | Server current time when the user Logged in to the Room, Unix timestamp, unit: milliseconds. |
| user_role | String | User role of the user Logged in to the Room.
This return parameter is only meaningful when integrating LiveRoom SDK. Please ignore this parameter when integrating Express SDK. |
| auth_level | String | Authentication level when the user Logged in.
|
| relogin | String | Relogin identifier.
|
| user_update_seq | String | Room user list change seq, increments by 1 when a user Logged in or Logged out. |
| callback_data | String | Custom callback information when the user Logged in, defaults to an empty string. |
It is recommended to convert some parameters to Int for logical processing. Related fields include appid, login_time, room_seq, session_id, timestamp, user_role, auth_level, and user_update_seq.
Data example
{
"event": "room_login",
"appid": "1",
"timestamp": "1499676978",
"nonce": "350176",
"signature": "signature",
"room_id": "rid_1242649",
"room_name": "room#123",
"room_seq": "6085791336856668982",
"user_account": "888120154",
"user_nickname": "888120154",
"session_id": "792148503087288320",
"login_time": "1499676978027",
"user_role": "2",
"auth_level": "4",
"relogin": "0",
"user_update_seq": "1",
"callback_data": "user login"
}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.
