diff --git a/index.bs b/index.bs index a4ae9ab..957fadc 100644 --- a/index.bs +++ b/index.bs @@ -8,6 +8,7 @@ URL: https://sockets-api.proposal.wintercg.org/ Repository: https://github.com/wintercg/proposal-sockets-api Editor: Dominik Picheta, Cloudflare https://cloudflare.com/, dominik@cloudflare.com Editor: Ethan Arrowood, Vercel https://vercel.com/, ethan.arrowood@vercel.com +Editor: James M Snell, Cloudflare https://cloudflare.com/, jsnell@cloudflare.com Abstract: Sockets API for Non-Browser EcmaScript-based runtimes. Markup Shorthands: markdown yes Markup Shorthands: idl yes @@ -42,12 +43,16 @@ A socket becomes closed when its {{close()}} method is called. A socket c
The [=connect=] method here is defined in a `sockets` module only for initial implementation purposes. It is imagined that in a finalized standard definition, the [=connect=] would be exposed as a global or within a [=binding object=]
+ A socket can be constructed using a connect method defined in a `sockets` module (early implementations may use `vendor:sockets` for the module name), or defined on a [=binding object=]. The connect method is the primary mechanism for creating a [=socket=] instance. It instantiates a socket with a resource identifier and some configuration values. It should synchronously return a socket instance in a pending state (or an error should be thrown). The socket will asynchronously connect depending on the implementation.A [=binding object=] in this context is essentially just an object that exposes 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: @@ -60,7 +65,7 @@ The binding object is the primary mechanism for runtimes to introduce unique behconst 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/). @@ -114,10 +119,6 @@ The terms {{ReadableStream}} and {{WritableStream}} are defined in [[WHATWG-STRE
The ReadableStream currently is defined to operate in non-byte mode, that is the `type` parameter to the ReadableStream constructor is not set. This means the stream's controller is {{ReadableStreamDefaultController}}. This, however, should be discussed and may be made configurable. It is reasonable, for instance, to assume that sockets used for most TCP cases would be byte-oriented, while sockets used for messages (e.g. UDP) would not.
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: "`.