@webqit/fetch-plus 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -236,9 +236,10 @@ Note that `request.port` above is assumed to be injected by the application runt
|
|
|
236
236
|
|
|
237
237
|
```js
|
|
238
238
|
const response = new LiveResponse(await fetch('http://localhost/hello'));
|
|
239
|
+
const { port } = await response.now();
|
|
239
240
|
|
|
240
|
-
|
|
241
|
-
|
|
241
|
+
port.postMessage('Hello from client');
|
|
242
|
+
port.addEventListener('message', (event) => {
|
|
242
243
|
console.log(event.data); // Hello from server
|
|
243
244
|
});
|
|
244
245
|
```
|
|
@@ -398,7 +399,7 @@ This is done via the `X-Message-Port` header.
|
|
|
398
399
|
import { StarPort, WebSocketPort } from '@webqit/port-plus';
|
|
399
400
|
|
|
400
401
|
// Create a port that will contain the ws instance
|
|
401
|
-
req.port = new StarPort();
|
|
402
|
+
req.port = new StarPort({ handshake: 1, postAwaitsOpen: true, autoClose: true });
|
|
402
403
|
const portId = crypto.randomUUID();
|
|
403
404
|
portRegistry.set(portId, req.port);
|
|
404
405
|
```
|