Bug 184688 - WebRTC DataChannel id of initiator not set
Summary: WebRTC DataChannel id of initiator not set
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 11
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
Keywords: InRadar
Depends on:
Reported: 2018-04-17 04:42 PDT by Danilo
Modified: 2022-06-23 12:20 PDT (History)
3 users (show)

See Also:

Demo (1.81 KB, application/gzip)
2018-04-17 04:42 PDT, Danilo
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Danilo 2018-04-17 04:42:14 PDT
Created attachment 338098 [details]

When creating a WebRTC DataChannel with in-band announcement (negotiated=false), the "id" attribute is not set on the side of the initiator.

Demo: https://tmp.dbrgn.ch/dc/

If you open this in Chromium or Firefox, the data channel id will be reported as an integer on both sides.

> DC1 is open. id=1
> DC2 is open. id=3
> New data channel. id=1
> New data channel. id=3

If you open it in Safari 11 or in the current technology preview, it will be reported as null on the initiator side.

> DC1 is open. id=null
> DC2 is open. id=null
> New data channel. id=1
> New data channel. id=3

The JS sourcecode can be found at https://tmp.dbrgn.ch/dc/dc.js.

From the spec (https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-id):

> The id attribute returns the ID for this RTCDataChannel . The value is initally null, which is what will be returned if the ID was not provided at channel creation time, and the DTLS role of the SCTP transport has not yet been negotiated. Otherwise, it will return the ID that was either selected by the script or generated by the user agent according to [ RTCWEB-DATA-PROTOCOL].

The current behavior seems to be a bug, and it breaks one of our data channel based applications in Safari.
Comment 1 Lennart Grahl 2018-07-26 09:57:44 PDT
My upcoming WPT tests confirm this bug: https://github.com/web-platform-tests/wpt/pull/10468

FWIW, if I hadn't worked around this bug, pretty much all of the data channel tests would fail. So, I would appreciate if you fix it, so I can remove the workaround from the WPT test suite.
Comment 2 Sam Sneddon [:gsnedders] 2022-06-21 14:36:57 PDT
Nowadays http://wpt.live/webrtc/RTCDataChannel-id.html
Comment 3 Radar WebKit Bug Importer 2022-06-21 14:37:10 PDT
Comment 4 youenn fablet 2022-06-23 00:39:22 PDT
Pull request: https://github.com/WebKit/WebKit/pull/1718
Comment 5 EWS 2022-06-23 12:20:45 PDT
Committed 251795@main (4bb2fa75278d): <https://commits.webkit.org/251795@main>

Reviewed commits have been landed. Closing PR #1718 and removing active labels.