webrtcsdpsctprtcdatachannel

Which kind of protocol packet that RTCDataChannel use to init the connection?


I know RTCDataChannel is using SCTP to init the connection but seems to it doesn't use SCTP packet (which have DATA Chunk,etc..) to init the connection, it use SDP packet.

When I tried with this demo and see the console it send the packet like this:

v=0
o=- 777388697042846508 2 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS
m=application 9 DTLS/SCTP 5000
c=IN IP4 0.0.0.0
a=ice-ufrag:ZE/xENc11wK9832B
a=ice-pwd:s9JV35l6IzPCPzSAhdcZrO7P
a=fingerprint:sha-256 AD:4B:A2:17:94:52:B5:68:8D:94:88:DD:37:98:B7:02:91:12:4D:FF:EE:32:76:80:11:12:AB:EE:4D:B7:15:16
a=setup:actpass
a=mid:data
a=sctpmap:5000 webrtc-datachannel 1024
common.js:8 14.954: Answer from remoteConnection 
v=0
o=- 8720098635349520996 2 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS
m=application 9 DTLS/SCTP 5000
c=IN IP4 0.0.0.0
b=AS:30
a=ice-ufrag:sVJDQDQk2/ONvM7v
a=ice-pwd:ET9E6bl6qNpnZY2d7l5xKMDi
a=fingerprint:sha-256 AD:4B:A2:17:94:52:B5:68:8D:94:88:DD:37:98:B7:02:91:12:4D:FF:EE:32:76:80:11:12:AB:EE:4D:B7:15:16
a=setup:active
a=mid:data
a=sctpmap:5000 webrtc-datachannel 1024

and as I know this is the format of SDP packet.

So anyone can help me clear about that?


Solution

  • In order to initiate the Datachannel (and your PeerConnection), you'll have to exchange a SDP (codecs, info about the Datachannel, ICE candidates, and so on...) between your clients.

    Then, you'll be able to exchange some data through the DC. You won't see SCTP because it is encapsulated under DTLS/UDP.

    But SCTP isn't used to init the connection. It is used to handle the connection and exchange the data of the Datachannel.