Example 21 Issues #648

Closed
aboba opened this Issue Jan 23, 2017 · 0 comments

Projects

None yet

1 participant

@aboba
Contributor
aboba commented Jan 23, 2017 edited

Example 21 is written from the perspective of the initiator of a DataChannel, however much of the code needs to be run on both ends (eg ice gathering, cert generation, dtls creation, etc). Also, the ordering in starting both Sctp and the DataChannel is not correct. Toward the end of the sample:

signaller.sendAccept({
// ... include ICE/DTLS info from other examples.
"sctpCapabilities": RTCSctpTransport.getCapabilities()
});

// Create the SctpTransport object and start it
var sctp = new RTCSctpTransport(dtls);
sctp.start(remote.sctpCapabilties);

The problem with the above is that the allocated port isn't signaled, and that to obtain that, it is necessary to construct the SctpTransport. So it should look more like this:

// Create the SctpTransport object
var sctp = new RTCSctpTransport(dtls);

signaller.sendAccept({
// ... include ICE/DTLS info from other examples.
"sctpCapabilities": RTCSctpTransport.getCapabilities()
"port": sctp.port
});

// Start the SctpTransport object
sctp.start(remote.sctpCapabilties);

To make things more clear, perhaps the order should be made explicit in the example:

  1. Bob gets his sctp caps and sends them to Alice.

  2. Alice receives the caps and uses them to start her sctp channel. Alice sends her caps back to Bob and listens for SctpChannel.OnDataChannel to fire.

  3. Bob receives the caps and uses them to start his sctp channel. Bob creates a DataChannel using the established sctp channel.

  4. Alice receives the SctpChannel.OnDataChannel event. Data channel now open.

@aboba aboba added the PR exists label Jan 23, 2017
@aboba aboba closed this Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment