diff --git a/index.html b/index.html index ee9db06..3476174 100644 --- a/index.html +++ b/index.html @@ -1292,8 +1292,7 @@

Transferable Data Channels

-

This section extends {{RTCDataChannel}} by making it transferable.

-

This allows sending and receiving messages outside the context the connection was created, for instance in workers or third-party iframes.

+

This section extends {{RTCDataChannel}} by exposing it to any type of {{Worker}} (not just DedicatedWorker).

The WebIDL changes are the following:

@@ -1301,58 +1300,6 @@ 

partial interface RTCDataChannel { };

-
-

The create an RTCDataChannel algorithm is updated by adding the following steps after step 4 of the original algorithm:

-
    -
  1. Initialize channel.`[[IsTransferable]]` to true.

  2. -
  3. Queue a task to run the following step:

    -
      -
    1. Set channel.`[[IsTransferable]]` to false.

    2. -
    -
  4. -
-

This task needs to run before any task enqueued by the receiving messages on a data channel algorithm for channel. - This ensures that no message is lost during the transfer of a {{RTCDataChannel}}.

-
-
The send() algorithm is modified by adding the following step after step 1 of the original algorithm: -
    -
  1. Set channel.`[[IsTransferable]]` to false.

  2. -
-
-
-

The {{RTCDataChannel}} transfer steps, given value and dataHolder, are:

-
    -
  1. If value.`[[IsTransferable]]` is false, throw a "DataCloneError" DOMException.

  2. -
  3. Set dataHolder.`[[ReadyState]]` to value.`[[ReadyState]]`.

  4. -
  5. Set dataHolder.`[[DataChannelLabel]]` to value.`[[DataChannelLabel]]`.

  6. -
  7. Set dataHolder.`[[Ordered]]` to value.`[[Ordered]]`.

  8. -
  9. Set dataHolder.`[[MaxPacketLifeTime]]` to value..`[[MaxPacketLifeTime]]`

  10. -
  11. Set dataHolder.`[[MaxRetransmits]]` to value.`[[MaxRetransmits]]`.

  12. -
  13. Set dataHolder.`[[DataChannelProtocol]]` to value.`[[DataChannelProtocol]]`.

  14. -
  15. Set dataHolder.`[[Negotiated]]` to value.`[[Negotiated]]`.

  16. -
  17. Set dataHolder.`[[DataChannelId]]` to value.`[[DataChannelId]]`.

  18. -
  19. Set dataHolder.`[[underlyingDataTransport]]` to value underlying data transport.

  20. -
  21. Set value.`[[IsTransferable]]` to false.

  22. -
  23. Set value.`[[ReadyState]]` to "closed".

  24. -
-
-

The {{RTCDataChannel}} [=transfer-receiving steps=], given dataHolder and channel, are:

-
    -
  1. Initialize channel.`[[ReadyState]]` to dataHolder.`[[ReadyState]]`.

  2. -
  3. Initialize channel.`[[DataChannelLabel]]` to dataHolder.`[[\DataChannelLabel]]`.

  4. -
  5. Initialize channel.`[[Ordered]]` to dataHolder.`[[Ordered]]`.

  6. -
  7. Initialize channel.`[[MaxPacketLifeTime]]` to dataHolder.`[[MaxPacketLifeTime]]`.

  8. -
  9. Initialize channel.`[[MaxRetransmits]]` to dataHolder.`[[MaxRetransmits]]`.

  10. -
  11. Initialize channel.`[[DataChannelProtocol]]` to dataHolder.`[[DataChannelProtocol]]`.

  12. -
  13. Initialize channel.`[[Negotiated]]` to dataHolder.`[[Negotiated]]`.

  14. -
  15. Initialize channel.`[[DataChannelId]]` to dataHolder.`[[DataChannelId]]`.

  16. -
  17. Initialize channel underlying data transport to dataHolder.`[[underlyingDataTransport]]`.

  18. -
-

The above steps do not need to transfer `[[BufferedAmount]]` as its value will always be equal to 0. - The reason is an {{RTCDataChannel}} can be transferred only if its send() algorithm was not called prior the transfer.

-

If the underlying data transport is closed at the time of the [=transfer-receiving steps=], - the {{RTCDataChannel}} object will be closed by running the announcing a data channel as closed algorithm immediately after the [=transfer-receiving steps=].

-