Skip to content

Commit

Permalink
fix all linking issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan Arrowood committed Sep 6, 2023
1 parent 6f76add commit 942a3f2
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ by the existing Node.js `net.Socket` API.

<h2 id="concepts">Concepts</h2>

<h3 id="socket-concept">Socket</h3>
<h3 id="socket-concept-section">Socket</h3>

A <dfn export>socket</dfn> represents a TCP connection, from which you can read and write data. A socket begins in a <i>connected</i> state (if the socket fails to connect, an error is thrown). While in a <i>connected</i> state, the socket's {{ReadableStream}} and {{WritableStream}} can be read from and written to respectively.
A <dfn export id="socket-concept">socket</dfn> represents a TCP connection, from which you can read and write data. A socket begins in a <i>connected</i> state (if the socket fails to connect, an error is thrown). While in a <i>connected</i> state, the socket's {{ReadableStream}} and {{WritableStream}} can be read from and written to respectively.

A socket becomes <i>closed</i> when its {{close()}} method is called. A socket configured with `allowHalfOpen: false` will close itself when it receives a FIN or RST packet in its read stream.

<h3 id="connect-concept">Connect</h3>
<h3 id="connect-concept-section">Connect</h3>

A socket can be constructed using a <dfn export>connect</dfn> method defined in a `sockets` module (early implementations may use `vendor:sockets` for the module name), or defined on a [=binding object=].
A socket can be constructed using a <dfn export id="connect-concept">connect</dfn> 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 syncronously return a socket instance in a <i>connected</i> state (or an error should be thrown).

Expand All @@ -65,7 +65,7 @@ tls_socket.connect();

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/).

<h2 id="socket">Socket</h2>
<h2 id="socket-section">Socket</h2>

<h3 id="using-a-socket">Using a socket</h3>

Expand Down Expand Up @@ -186,7 +186,7 @@ Cancelling the socket's ReadableStream and closing the socket's WritableStream d

<h4 id="close-method">close()</h4>

The {{close()}} method closes the socket and its underlying connection.
The {{close()}} method closes the socket and its underlying connection. It returns the same promise as the {{closed}} attribute.

<h4 id="starttls-method">startTls()</h4>

Expand All @@ -201,7 +201,7 @@ In this `secureTransport` mode of operation the socket begins the connection in
</ul>

<aside class="example">
Here is a simple code example showing usage of the `startTls()` method:
Here is a simple code example showing usage of the {{startTls()}} method:

<pre highlight="js">
import { connect } from 'sockets';
Expand Down Expand Up @@ -234,7 +234,7 @@ The method must fail with an [=SocketError=] if:
Should result in the following error: `Uncaught SocketError [TypeError]: SocketError: connection failed`.
</div>

<h2 id="connect">connect</h2>
<h2 id="connect-section">connect</h2>

<pre class="idl">
[Exposed=*]
Expand Down Expand Up @@ -291,23 +291,20 @@ At any point during the creation of the {{Socket}} instance, `connect` may throw
<dt>{{on}}</dt>
<dd>A TLS connection is established using default CAs</dd>
<dt>{{starttls}}</dt>
<dd>Initially the same as the `off` option, the connection continues in plain text
until the <a>`startTls` method</a> is called</dd>
<dd>Initially the same as the `off` option, the connection continues in plain text until the {{startTls()}} method is called</dd>
</dl>
</dd>
<dt>
{{allowHalfOpen}} member
</dt>
<dd>
This option is similar to that offered by the Node.js `net` module and allows interoperability
with code which utilizes it.
This option is similar to that offered by the Node.js `net` module and allows interoperability with code which utilizes it.
<dl>
<dt>false</dt>
<dd>The WritableStream- and the socket instance- will be automatically closed when a
FIN packet is received from the remote connection.</dd>
<dt>true</dt>
<dd>When a FIN packet is received, the socket will enter a "half-open" state where the
ReadableStream is closed but the WritableStream can still be written to.</dd>
<dd>When a FIN packet is received, the socket will enter a "half-open" state where the ReadableStream is closed but the WritableStream can still be written to.</dd>
</dl>
</dd>
</dl>
Expand All @@ -321,9 +318,9 @@ At any point during the creation of the {{Socket}} instance, `connect` may throw
<dd>
The address to connect to. For example `{ hostname: "google.com", port: 443 }`.
<dl>
<dt>hostname</dt>
<dt>{{hostname}}</dt>
<dd>A connection is established in plain text.</dd>
<dt>port</dt>
<dt>{{port}}</dt>
<dd>A TLS connection is established using default CAs</dd>
</dl>
</dd>
Expand Down

0 comments on commit 942a3f2

Please sign in to comment.