How do I send a message about the loss of the source in Telegram?
Here is a simple solution to this task.
A server with PHP will be used.
Adding event collection to our server to the Flussonic configuration:
notify source_lost {
sink http://backend.local/notify.php;
only event=source_closed,source_switch;
}
Our PHP script will collect data via “php://input”. “php://input” is a read-only stream that allows you to read raw data from the request body
https://www.php.net/manual/en/wrappers.php.php
The data will be received in the following format:
[{"bitrate":168,"bytes":1498499952,"duration":65145,"event":"source_closed","event_id":3090,"id":"618d201d-6c1f-4a64-8ba6-1a04d9a3fc23","ip":null,"loglevel":"info","media":"test","opened_at":1636638749432,"priority":1,"proto":"fake","reason":"shutdown","server":"es1.e","source_id":null,"url":"fake://fake","user_agent":null,"utc_ms":1636703893952}]
Having received the stream name from “media”:“test” and using the Telegram API, you can send the required message
can you give me an example to read json file from flusonic sent?
do you need an example of handler code or example of json in POST body?