How to Receive Event Notification

Last updated: 2020-09-17 16:23:49

    If an event configured in the template triggers the callback during live streaming, Tencent Cloud will send a request to your server which is responsible for the response. After authentication, a JSON packet of the callback can be obtained.

    Currently, the following LVB events can trigger a notification: stream push, stream interruption, recording, screencapturing, and porn detection.

    Overall Process

    Process description:

    1. The host configures event message notification URLs and related features such as recording and screencapturing in the console or by calling TencentCloud APIs.
    2. The host pushes a stream or interrupts the push.
    3. When an event occurs in the LVB service, a message will be sent to viewers through the event message notification service.

      Event Message Notification Protocol

    Network protocol

    • Request: HTTP POST request with a JSON packet. The specific packet content of each type of message is described later.
    • Response: HTTP STATUS CODE = 200. The server ignores the specific content of the response packet. For more accurate connection, we recommend you add JSON: {"code":0} to the response.

    Notification reliability

    There is a retry mechanism for event notification service. Such retries will be made with an interval of 60 seconds for a total of 3 times. To avoid the impact of such retries on your server and network bandwidth, you should make sure that the response packet can be returned normally. A retry will be triggered in the following cases:

    • No response packet is returned for a long time (at least 20 seconds).
    • The HTTP status code in the response is not 200.

    Callback Event Configuration

    Callback configuration can mainly be implemented in two ways: in the LVB Console and through server API.

    Note:

    You can configure different callback URLs for LVB stream push, stream interruption, recording, screencapturing, and porn detection events.

    LVB Console

    1. Go to Feature Template > Callback Configuration in the LVB Console to create a callback template. For detailed directions, please see Creating Callback Template.
    2. Select Domain Management, find the target push domain name, and click Manage > Template Configuration to associate it with the callback template. For detailed directions, please see Callback Configuration.

      Server API

    3. Call CreateLiveCallbackTemplate to create a callback template and set the callback parameters you need.
    4. Call CreateLiveCallbackRule to create a callback rule, set the DomainName and TemplateId (returned in step 1) parameters, and enter the same AppName as in the push and playback addresses to enable callback for certain live streams.

    Callback Message Parameter Description

    After the callback template is successfully associated with the domain name, when a template event is triggered during live streaming, Tencent Cloud will actively send a JSON packet containing the callback message to your server. Specific parameters of the callback message are described as follows:

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help