diff --git a/index.bs b/index.bs index 69abfea..a28b324 100644 --- a/index.bs +++ b/index.bs @@ -51,6 +51,8 @@ The connect method is the primary mechanism for creating a [=socket=] instance.

Binding Object

+

A [=binding object=] in this context is essentially just an object that exposes the a [=connect=] method conformant with this specification. It is anticipated that a runtime may have any number of such objects. This is an area where there is still active discussion on how this should be defined.

+ The binding object defines extra socket `connect` options. The options it contains can modify the behaviour of the `connect` invoked on it. Some of the options it can define: @@ -63,7 +65,7 @@ The binding object is the primary mechanism for runtimes to introduce unique beh
 const tls_socket = new TLSSocket({ key: '...', cert: '...' });
-tls_socket.connect();
+tls_socket.connect("example.com:1234");
 
Additionally, the binding object does not necessarily have to be an instance of a class, nor does it even have to be JavaScript. It can be any mechanism that exposes the {{connect()}} method. Cloudflare achieves this through [environment bindings](https://developers.cloudflare.com/workers/configuration/bindings/). @@ -145,9 +147,7 @@ The {{readable}} attribute is a {{ReadableStream}} which receives data from the -The ReadableStream operates in non-byte mode, that is the `type` parameter to the -ReadableStream constructor is not set. -This means the stream's controller is {{ReadableStreamDefaultController}}. +The ReadableStream currently is defined to operate in byte mode, that is the `type` parameter to the ReadableStream constructor is set to `'bytes'`. This means the stream's controller is {{ReadableByteStreamDController}}.

writable

@@ -253,6 +253,8 @@ The method must fail with an [=SocketError=] if:

SocketError

+

Arguably, this should be a type of {{DOMException}} rather than {{TypeError}}. More discussion is necessary on the form and structure of socket-related errors.

+ SocketError is an instance of {{TypeError}}. The error message should start with `"SocketError: "`.
@@ -299,11 +301,11 @@ The {{connect()}} method performs the following steps:
  • The created {{Socket}} instance is returned immediately in a pending state.
  • A connection is established to the specified {{SocketAddress}} asynchronously.
  • Once the connection is established, set |info| to a new {{SocketInfo}}, and [=Resolve=] |opened| with |info|. For a socket using secure transport, the connection is considered to be established once the secure handshake has been completed.
  • -
  • If the connection fails for any reason, the socket's {{closed}} and {{opened}} promises are rejected with a [=SocketError=] describing why the connection failed.
  • -
  • The instance's {{ReadableStream}} and {{WritableStream}} streams can be used immediately.
  • +
  • If the connection fails for any reason, set |error| to a new [=SocketError=] and reject the socket's {{closed}} and {{opened}} promises with |error|. Also, the {{readable}} is canceled with |error| and the {{writable}} is aborted with |error|.
  • +
  • The instance's {{ReadableStream}} and {{WritableStream}} streams can be used immediately but may not actually transmit or receive data until the socket is fully opened.
  • -At any point during the creation of the {{Socket}} instance, `connect` may throw a [=SocketError=]. One case where this can happen is if the input address is incorrectly formatted. Errors which occur asynchronously (after the socket instance has been returned) must reject the socket's {{closed}} promise. +At any point during the creation of the {{Socket}} instance, `connect` may throw a [=SocketError=]. One case where this can happen is if the input address is incorrectly formatted.
    The implementation may consider blocking connections to certain hostname/port combinations which can pose a threat of abuse or security vulnerability.