/

Webhooks


Included with the Red5 Pro live webapp is a webhook functionality that can call a custom REST endpoint to push stream publish and unpublish events.


CONFIGURATION

This feature is configured in the server side live webapp and must be applied to all streaming nodes (Transcoders, Origins, Relays and Edges) that are expected to provide events.

Configure the webapp by opening {Red5Pro}/webapps/live/WEB-INF/red5-web.properties and updating the webhooks.endpoint configuration with the URI for the server to call:

webapp.contextPath=/live
webapp.virtualHosts=*

# Optional endpoint like http://localhost:8001/webhook for stream-published, stream-unpublished webhook events
# Leave empty if not used
webhooks.endpoint=https://localhost:8001/webhook

Note: If the feature is not used, webhooks.endpoint must be left empty. It is important not to comment or remove this configuration line as that would prevent the live application from working correctly.

API

Every time a new stream is published or unpublished, the live application will make the following call to the URI configured in webhooks.endpoint:

URI: {webhooks.endpoint}
Method: POST
Content-Type: application/json
Body: 
{
  "event":"stream-published"|"stream-unpublished"
  "guid":"live/stream1"
  "clusterNodeType":"TYPE_OFF"|"TYPE_ORIGIN"|"TYPE_EDGE"|"TYPE_RELAY"|"TYPE_TRANSCODER"
}

Where:

  • event - is stream-published for publish events and stream-unpublished for unpublish events
  • guid - is the guid of the stream created as <scope>/<room>/<stream>
  • clusterNodeType - is a string indicating the type of the node that made the webhook call. For standalone servers the type will be TYPE_OFF, while for Autoscaling deployments nodes will report their role.