Initiating document transcoding, real-time recording, and other operations requires some time to complete. You can register a callback interface by calling the server-side API. When events such as changes in document transcoding progress or the start of real-time recording occur, the interactive whiteboard can promptly notify the app through the callback interface.
The interactive whiteboard supports the following types of event notifications:
Categorization | Related API interface | Event notification |
File Transcoding | ||
| | |
Real-time recording | ||
| | |
| | |
| | |
Whiteboard Streaming | ||
| | |
Event Callback Authentication
When your backend receives a callback for real-time recording/document transcoding, you can verify the signature to confirm that the callback message is indeed from the Tencent Cloud backend. The signature algorithm is as follows:
Sign = md5(CallbackKey+ExpireTime)
CallbackKey: Authentication Key, you can set it through the Interactive Whiteboard Console or by calling the Real-time Recording (SetOnlineRecordCallbackKey) or Document Transcoding (SetTranscodeCallbackKey) API interfaces.
ExpireTime: Signature expiration time, if the expire_time value specified in a notification has already expired, the notification can be considered invalid, thus preventing network replay attacks. The format is a decimal UNIX timestamp, which is the number of seconds elapsed since midnight (UTC/GMT) on January 1, 1970.
For example:
CallbackKey = Xz4ZgayTr7rMgWQrHExpireTime = 1588040109Sign = md5(Xz4ZgayTr7rMgWQrH1588040109) = a2dabb362a9b811c0e26953a6276a41c
If the callback key is set, when you receive a callback request, it will carry the
ExpireTime and Sign parameters. You can use these values and the callback key you set to calculate and verify whether the request is from Tencent Cloud.Event callback protocol
Request: The event callback initiated by Whiteboard is in the form of an HTTP POST request. The request body is in JSON format, and the content is as follows:
Parameter Name | Type | Description |
Timestamp | Integer | The Unix timestamp generated by the event, in seconds |
SdkAppId | Integer | The SdkAppId of the Whiteboard application that triggers the event |
ExpireTime | Integer | The expiration time of the signature in Unix timestamp, in seconds. If the current time is later than the expiration time, the backend can determine that the request is invalid |
Sign | String | Callback signature, you can verify whether the signature matches according to the method described in Event Callback Authentication to validate if the request comes from Tencent Cloud |
EventType | String | Event Type |
EventData | JSON | Specific event information, as detailed in the event documentation |
For example, the callback format when document transcoding progress changes:
{"EventData": {"ResultUrl": "","Pages": 21,"Progress": 10,"Resolution": "960x540","TaskId": "gaqvbm16jr2q4uhm23rb","Title": "example.pptx"}"EventType": "PPT2H5ProgressChanged","ExpireTime": 1588040109,"SdkAppId": 1400000001,"Sign": "a2dabb362a9b811c0e26953a6276a41c","Timestamp": 1590045522}
Response: HTTP STATUS CODE =
200, the server ignores the specific content of the response packet. For protocol friendliness, it is recommended that the client response content carries JSON: {"error_code":0}The event notification has a retry mechanism. The retry interval is 5 seconds, with a total of 5 retries. To prevent the retry from placing too much strain on your server and bandwidth, make sure response packets are returned as expected. A retry is triggered in the following cases:
No response packet is returned for a long time (10 seconds).
Response HTTP STATUS is not
200.