@@ -34,8 +34,9 @@ similarities with that document.
34
34
`Socket` interface {#socket-interface}
35
35
======================================
36
36
37
- A `Socket` can be constructed using the global {{connect}} method, or a `connect` method
38
- defined on a <a>binding object</a> .
37
+ A `Socket` can be constructed using a {{connect}} method defined in a `sockets` module
38
+ (early implementations may use `vendor:sockets` for the module name),
39
+ or a `connect` method defined on a <a>binding object</a> .
39
40
40
41
<pre class="idl">
41
42
[Exposed=*]
@@ -74,6 +75,7 @@ Methods available on a {{Socket}} instance are described by the following table:
74
75
The below example shows typical {{ReadableStream}} usage to read data from a socket:
75
76
76
77
```javascript
78
+ import { connect } from 'sockets' ;
77
79
const socket = connect("google.com:80");
78
80
79
81
const reader = socket.readable.getReader();
@@ -104,6 +106,7 @@ This means the stream's controller is {{ReadableStreamDefaultController}}.
104
106
The below example shows typical {{WritableStream}} usage to write data to a socket:
105
107
106
108
```javascript
109
+ import { connect } from 'sockets' ;
107
110
const socket = connect("google.com:80");
108
111
109
112
const writer = socket.writable.getWriter();
@@ -164,6 +167,7 @@ connection in plain-text, with messages read and written without any encryption.
164
167
Here is a simple code example showing usage:
165
168
166
169
```js
170
+ import { connect } from 'sockets' ;
167
171
let sock = connect("google.com:443", { secureTransport: "starttls" });
168
172
// ... some code here ...
169
173
// We want to StartTLS at this point.
0 commit comments