Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify when a data channel's ID is assigned, and what the id attribute returns when no ID is assigned. #795

Closed
taylor-b opened this issue Sep 17, 2016 · 8 comments
Assignees

Comments

@taylor-b
Copy link
Contributor

taylor-b commented Sep 17, 2016

This is an issue I noticed when working on a solution for issue #746.

The WebRTC data channel establishment spec requires that DTLS clients choose even stream IDs, and DTLS servers choose odd IDs.

However, the DTLS role may not be known at the time of creating a data channel. So, until the role is determined, what does the id attribute return? It's worth noting that both Chrome and Firefox currently return an ID of 65535, which is guaranteed to be out of range (the maximum usable ID is 65534). But it seems more "correct" to make the attribute nullable.

And then, when should a user script expect the ID to be populated? When the stable signaling state is reached with an SCTP media description negotiated? That would seem reasonable to me.

@alvestrand
Copy link
Contributor

@taylor-b There was a discussion at TPAC about this - can you make a PR based on your memory of the conclusion?

@taylor-b
Copy link
Contributor Author

Are you sure we discussed this at TPAC? My memory's blanking and I can't find anything in the minutes. It's also not in the slide deck. I filed this issue as I was making the slides for issue #746, so it's possible we never touched on it.

@alvestrand
Copy link
Contributor

It seems that nobody is able to figure out a precise issue that needs solving under this title, so closing.

@taylor-b
Copy link
Contributor Author

This still is an issue as far as I can tell. Does it need a better title?

@alvestrand
Copy link
Contributor

The part we understood seemed to have been covered by #746. Can you try to explain it better?

@taylor-b
Copy link
Contributor Author

taylor-b commented Jan 26, 2017

#746 deals with calling createDataChannel with an invalid ID. This issue deals with calling createDataChannel with no ID (letting the browser choose the ID). Maybe an example will clear things up:

pc = new RTCPeerConnection();
dc = pc.createDataChannel("foo");
// What is dc.id? 65535 or null?
// ...
pc.setLocalDescription(offer);
// ...
pc.setRemoteDescription(answer_with_active_role);
// Now we know the DTLS role. An odd value (1) is chosen for dc.id.

I think it would be pretty uncontroversial to say the DTLS role (and thus the data channel ID) is determined when applying an answer. So the main question is what the id attribute returns when no ID is chosen yet.

@alvestrand
Copy link
Contributor

I'd think leaving it as null (which means it has to be nullable) would be the clearest way to do it.
Any "marker" value risks being a possibly-useful value if we change the underlying protocol, but null won't be.

Reopening issue.

@aboba
Copy link
Contributor

aboba commented Feb 23, 2017

@taylor-b Can you submit a PR?

taylor-b added a commit to taylor-b/webrtc-pc that referenced this issue Feb 24, 2017
Fixes w3c#795.

When a data channel is initially created, and a ID isn't explicitly
provided, it will only be set after the DTLS role is negotiated by an
SDP answer. If a data channel is created after this answer is set, an
ID will be set instantly.

Until the id is set, the attribute will return null.
taylor-b added a commit to taylor-b/webrtc-pc that referenced this issue Apr 20, 2017
Fixes w3c#1132.

This is an editorial change; the behavior described here was already
decided when issue w3c#795 was discussed.
taylor-b added a commit to taylor-b/webrtc-pc that referenced this issue Apr 20, 2017
Fixes w3c#1132.

This is an editorial change; the behavior described here was already
decided when issue w3c#795 was discussed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants