when initiator can send message via DataChannel. Example 22 #240

Closed
Jxck opened this Issue Sep 15, 2015 · 5 comments

Projects

None yet

3 participants

@Jxck
Contributor
Jxck commented Sep 15, 2015

in Example 22

in initiate(), sends message to channel before received remote sctp capabilities.

function initiate(signaller) {
  // snip...

  signaller.sendInitiate({
    // ... include ICE/DTLS info from other example.
    "sctpCapabilities": RTCSctpTransport.getCapabilities()
  }, function(remote) {
    sctp.start(remote.sctpCapabilities);
  });

  var channel = new RTCDataChannel(sctp, parameters);
  channel.send("foo"); // in this state, channel doesn't connected isn't it ?
}

I think it's better to send message after channel has connected.

function initiate(signaller) {
  // snip...

  signaller.sendInitiate({
    // ... include ICE/DTLS info from other example.
    "sctpCapabilities": RTCSctpTransport.getCapabilities()
  }, function(remote) {
    sctp.start(remote.sctpCapabilities);

    var channel = new RTCDataChannel(sctp, parameters);
    channel.send("foo"); // in this state, channel doesn't connected isn't it ?
  });
}

is that correct ?
or receive RTCDataChannel from ondatachannel event in initiate too ?

@aboba aboba added 1.1 1.0 and removed 1.0 labels Sep 15, 2015
@robin-raymond
Contributor

FYI - you can construct the DataChannel before SctpTransport.start is called. Data sent before start is called should be buffered until SctpTransport is started and underlying dtls is established.

@robin-raymond
Contributor

Report party received ondatachannel event if params.negotiated = false.

@aboba
Contributor
aboba commented Sep 18, 2015

I will add a comment to make it clear that data cannot be sent until sctp.start() is called.

@robin-raymond
Contributor

In webrtc 1.0 is says If channel's readyState attribute is connecting, throw an InvalidStateError exception and abort these steps..

@robin-raymond robin-raymond removed the wontfix label Sep 21, 2015
@aboba aboba added the 1.0 label Sep 21, 2015
@aboba
Contributor
aboba commented Sep 21, 2015

As a clarification, proposal is to add the following text (contained in WebRTC 1.0 Section 6.2.3) to the ORTC specification Section 11.3.2:

The send() method is overloaded to handle different data argument types. When any version of the method is called, the user agent must run the following steps:

Let channel be the RTCDataChannel object on which data is to be sent.

If channel.readyState attribute is connecting, throw an InvalidStateError exception and abort these steps.

Execute the sub step that corresponds to the type of the methods argument:

string object:

Let data be the result of converting the argument object to a sequence of Unicode characters and increase the bufferedAmount attribute by the number of bytes needed to express data as UTF-8.

Blob object:

Let data be the raw data represented by the Blob object and increase the bufferedAmount attribute by the size of data, in bytes.

ArrayBuffer object:

Let data be the data stored in the buffer described by the ArrayBuffer object and increase the bufferedAmount attribute by the length of the ArrayBuffer in bytes.

ArrayBufferView object:

Let data be the data stored in the section of the buffer described by the ArrayBuffer object that the ArrayBufferView object references and increase the bufferedAmount attribute by the length of the ArrayBufferView in bytes.

If channel's underlying data transport is not established yet, or if the closing procedure has started, then abort these steps.

Attempt to send data on channel's underlying data transport; if the data cannot be sent, e.g. because it would need to be buffered but the buffer is full, the user agent must abruptly close channel's underlying data transport with an error.

@robin-raymond robin-raymond pushed a commit that referenced this issue Oct 6, 2015
Robin Raymond - Clarified behavior of RTCDataChannel.send(), as noted in:
#240

- Fixed typos in Example 11, as noted in:
#241
#248

- Added text relating to RTCDataChannel exceptions and errors, as noted in:
#242

- Reconciliation of RTCRtpEncodingParameters dictionary with WebRTC 1.0, as noted in:
#249
e395344
@aboba aboba closed this Oct 6, 2015
@Jxck Jxck added a commit to Jxck/ortc that referenced this issue Oct 15, 2015
@Jxck Robin Raymond + Jxck - Clarified behavior of RTCDataChannel.send(), as noted in:
w3c#240

- Fixed typos in Example 11, as noted in:
w3c#241
w3c#248

- Added text relating to RTCDataChannel exceptions and errors, as noted in:
w3c#242

- Reconciliation of RTCRtpEncodingParameters dictionary with WebRTC 1.0, as noted in:
w3c#249
5be6f84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment