GstWebRTC - Data Channel

From RidgeRun Developer Connection
Jump to: navigation, search



Previous: GstWebRTCBin Features Index Next: Evaluating GstWebRTC




Ridgerun's GstRrWebRTC provides data channel support. Data channel can be used for data transfer between endpoints by using the SCTP protocol, which allows flow and congestion control. The reliability and delivery order of data are configurable on the SCTP ptotocol.

  • Reliability means that an endpoint is able to know if the data was received or not by the other endpoint.
  • Order means that data is received in the same order it was sent.

Data channel in GstRrWebRTC works with a combination of elements that provide support for data transfer between multiple endpoints on a single session. Such elements are presented in the following image:

Elements involved in data transfer


GstWebRTCBin Data Properties

The GstWebRTCBin element exposes some properties that can be used to configure the endpoints functionality on data transfer:

  • data-port:

Specify the desired SCTP port to use for data transfer. Its value must be defined in the range: [0 - 65535]. If not used, the port 5000 is assigned by default.

  • data-channel-id:

Specify an identifier for each data channel stream. Default: Its value must be defined in the range: [0 - 65535]. If not used, a random port in that range is assigned by default.

  • enable-data:

Used to enable the negotiation of the WebRTC data channel for an endpoint. It is required to use the new_data and on_new_data callbacks without data-pads. If not used, the data channel support wont be enabled (false by default).

  • data-channel-status:

This property represents the connection status, which indicate if data channel is currently connected. If not used, such information wont be displayed (false by default).

Data Channel Usage

There is an application called datachannel inside the gst-webrtc/tests/examples/data_channel' folder. This application allows to establish communication between two endpoints in order to transfer audio, video and data.

Options

-c, --channel = C       Channel to register (The session ID)
-p, --peer-channel=P    Peer channel
-a, --no-audio          Don't use audio in the WebRTC session
-v, --no-video          Don't use video in the WebRTC session
-d, --no-data           Don't use data in the WebRTC session
-o, --owr-signaler      Use OWR signaler (by default Pubnub signaler is used)
-s, --start-call        Start the call from this endpoint (Disabled by default)

Example

You can run the application as follows:

./datachannel -c room0 -a -o -s

Go to the browser on the https://webrtc.ridgerun.com:8443/ page and use room0 as the Session ID. It is not necessary to press the Call button since the -s option is used. After the connection establishment you should be able to send messages from the pipeline to the browser and from the browser to the pipeline, as shown below.

Datachannel App Example



Previous: GstWebRTCBin Features Index Next: Evaluating GstWebRTC