This project allows to forward RTSP streams to WebRTC peers.
The configuration is stored in a YAML file named config.yaml
. The following keys are available:
Device.URL
: The URL of the RTSP stream to forwardMQTT.Username
: The username to use to connect to the MQTT brokerMQTT.Password
: The password to use to connect to the MQTT brokerMQTT.URL
: The URL of the MQTT brokerMQTT.Name
: The name to use to identify the proxy in the MQTT broker
- Build the project using
go build
- Copy the
config.yaml
to the same directory as the executable - Run the executable
The proxy will then forward the RTSP stream to WebRTC peers connected to the MQTT broker.
The proxy and client use mqtt for signaling and google for turn/stun.
The proxy sends a message to the MQTT broker with the topic devices
and the payload
being a JSON object containing the following keys:
id
: The id of the devicename
: The name of the deviceonline
: true if the device is online, false otherwisestreaming
: true if the device is currently streaming, false otherwisetype
: The type of the device, alwayssender
for the proxy.
This message is sent every time the proxy starts and every time a query request is received.
The proxy and client use the following topics in the MQTT broker:
The proxy sends a message to this topic with the payload being a JSON object containing the following keys:
id
: The id of the devicename
: The name of the deviceonline
: true if the device is online, false otherwisestreaming
: true if the device is currently streaming, false otherwisetype
: The type of the device, alwayssender
for the proxy.
This message is sent every time the proxy starts and every time a query request is received.
This topic is used to send / receive message between 2 peers Every client is listening to the /clientId topic.
The proxy and client use this topic to send and receive SDP messages.
The message payload is a JSON object containing the following keys:
source
: The id of the device that sent the messagetype
: The type of the message, alwayssdp
data
: The SDP message wich can be offer or answer.
The proxy and client use this topic to send and receive ICE messages.
The message payload is a JSON object containing the following keys:
source
: The id of the device that sent the messagetype
: The type of the message, alwaysice
data
: The ICE message
Send and receive hangup messages.
The message payload is a JSON object containing the following keys:
source
: The id of the device that sent the messagetype
: The type of the message, alwayshangup
Send and receive device query message
source
: The id of the device that sent the messagetype
: The type of the message, alwaysQuery