WebRTC Data Channel Protocol First draft. This document specifies a method for establishing a direct connection using SCTP channels over DTLS. As WebRTC supports the SCTP partial reliability extension (see &rfc3758;), the connection established can either be reliable or partial-reliable. However due to the wider use (e.g. &xep0234;) and easier maintenance, this transport method defines the mandatory use of reliable and in-order-delivery datachannels (thus a streaming transport). If the need for partial-reliability is there, a second specification for datagram type datachannels might be created. The establishment of this connection is managed by &xep0176;. The establishment of security provided by DTLS is described in &xep0320;. There are several use cases. Given below are a few examples: In accordance with Section 10 of XEP-0166, this document specifies the following information related to the Jingle DTLS/SCTP transport method: The transport negotiation process is defined in the Protocol Description section of this document. The semantics of the &SCTPMAP; element are defined in the Syntax section of this document. This protocol requires the Stream Control Transmission Protocol (SCTP) to run within the security context of the Datagram Transport Layer Security (DTLS) protocol. As determined by RTCWeb Data Channels running SCTP on top of DTLS is preferred, as in this order the control messages are encrypted as well and the DTLS channel can be shared with several applications In order for the initiator in a Jingle exchange to start the negotiation, it sends a Jingle "session-initiate" stanza that includes at least one content type, as described in XEP-0166. If the initiator wishes to negotiate the SCTP transport method for an application format, it MUST include a &SCTPMAP; child element qualified by the 'urn:xmpp:jingle:transports:dtls-sctp:1' namespace &VNOTE;. The &TRANSPORT; element SHOULD in turn contain one &CANDIDATE; element for each of the initiator's higher-priority transport candidates as determined in accordance with the ICE methodology, but MAY instead be empty (with each candidate to be sent as the payload of a transport-info message). As seen in the example, there is no notion about DataChannel internals. The only things negotiated here are the port on which the SCTP Stream runs and the name of the DataChannel. Further negotiation is happening through the &webrtc-protocol;, thus the DataChannel is identified through the content name. The values and names for the &SCTPMAP; element are taken from the corresponding SDP. The attributes of the <sctpmap/> element are as follows. As described in XEP-0166, to acknowledge receipt of the session initiation request, the responder immediately returns an IQ-result. Depending on the application type, a user agent controlled by a human user might need to wait for the user to affirm a desire to proceed with the session before continuing. When the user agent has received such affirmation (or if the user agent can automatically proceed for any reason, e.g. because no human intervention is expected or because a human user has configured the user agent to automatically accept sessions with a given entity), it returns a Jingle session-accept message. This message MUST contain a &TRANSPORT; element qualified by the 'urn:xmpp:jingle:transports:ice-udp:1' namespace, which SHOULD in turn contain one &SCTPMAP; element qualified by the 'urn:xmpp:jingle:transports:dtls-sctp:1' namespace for the channel used by the responder. Note: See the Security Considerations section of this document regarding the exposure of IP addresses by the responder's client. The initiator acknowledges the Jingle session-accept. Even after media has begun to flow, either party MAY continue to send additional channels to the other party (e.g., because the user wants to transmit a new file). Such events are shared by sending a content-add message. The receiving party MUST acknowledge receipt. By design is the sent media already encrypted by the DTLS layer Special thanks to István Koren at i5 and their XMPP Experience Thanks to Philipp Hancke and Tobias Markmann for their help and support and all the XEP-Authors for their examples. This document requires no interaction with &IANA;. This specification defines the following XML namespace: The ®ISTRAR; includes the foregoing namespace in its registry at &NAMESPACES;, as governed by &xep0053;. The registry submission is as follows.
Name
Description
SDP Syntax
Example
port
A port number where the channel is to be contacted
Port value in a=sctpmap line
5000
protocol
Media format
Protocol value in a=sctpmap line
webrtc-datachannel
streams
Number of supported incoming streams
Stream value in a=sctpmap line
16