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:
Bob gets his sctp caps and sends them to Alice.
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.
Bob receives the caps and uses them to start his sctp channel. Bob creates a DataChannel using the established sctp channel.
Alice receives the SctpChannel.OnDataChannel event. Data channel now open.
The text was updated successfully, but these errors were encountered:
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:
Bob gets his sctp caps and sends them to Alice.
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.
Bob receives the caps and uses them to start his sctp channel. Bob creates a DataChannel using the established sctp channel.
Alice receives the SctpChannel.OnDataChannel event. Data channel now open.
The text was updated successfully, but these errors were encountered: