@dojo-ng/websocket 0.1.0 → 0.1.1
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 +7 -8
- package/package.json +2 -2
- package/schema/envelope.schema.json +1 -1
package/README.md
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A framework-agnostic WebSocket client: a raw-socket wrapper (`WSocket`) and a convenience
|
|
4
4
|
dispatcher on top of it (`WSDispatcher`) with request/response correlation, an offline send
|
|
5
|
-
queue, reconnect with backoff, and a heartbeat watchdog.
|
|
6
|
-
|
|
7
|
-
the reasoning behind every non-obvious decision below.
|
|
5
|
+
queue, reconnect with backoff, and a heartbeat watchdog. The reasoning behind each non-obvious
|
|
6
|
+
behavior below is in the header comments of `src/wsocket.ts` and `src/wsdispatcher.ts`.
|
|
8
7
|
|
|
9
8
|
Part of the [Dojo NG framework](../../README.md) monorepo (the non-Lit runtime that complements
|
|
10
9
|
`components`). BSD-3-Clause.
|
|
@@ -75,11 +74,11 @@ affordance; the playground (below) uses it.
|
|
|
75
74
|
|
|
76
75
|
`schema/envelope.schema.json` (JSON Schema draft-07) specifies the `{action, id, data}` frame
|
|
77
76
|
`WSDispatcher` sends and receives, independently of the TypeScript `Envelope` type that binds it
|
|
78
|
-
— the schema is the source of truth, the type is one binding of it.
|
|
79
|
-
positional-array form by measurement, not argument: compressed (raw
|
|
80
|
-
across a session — the realistic case), the object form is only 3.4%
|
|
81
|
-
a representative session.
|
|
82
|
-
|
|
77
|
+
— the schema is the source of truth, the type is one binding of it. The object form was chosen
|
|
78
|
+
over a positional-array form (`[action, id, data]`) by measurement, not argument: compressed (raw
|
|
79
|
+
DEFLATE, context carried across a session — the realistic case), the object form is only 3.4%
|
|
80
|
+
larger than positional over a representative session. `spike/measure-envelope.mjs` reproduces
|
|
81
|
+
the measurement.
|
|
83
82
|
|
|
84
83
|
## Playground
|
|
85
84
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dojo-ng/websocket",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Dojo NG websocket client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"license": "BSD-3-Clause",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@dojo-ng/pubsub": "^0.1.
|
|
15
|
+
"@dojo-ng/pubsub": "^0.1.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"ajv": "^8.20.0",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$id": "https://dojo-ng.dev/schemas/websocket-envelope.schema.json",
|
|
4
4
|
"title": "Dojo NG WebSocket envelope",
|
|
5
|
-
"description": "The wire frame WSDispatcher
|
|
5
|
+
"description": "The wire frame WSDispatcher sends and receives, specified independently of the TypeScript types that bind it (src/wsdispatcher.ts's Envelope interface is one binding of this, not the source of truth). The object shape was chosen over a positional array by measuring compressed bytes on the wire; spike/measure-envelope.mjs reproduces the measurement. Every field is always present; there is no undefined-vs-missing distinction on the wire, only JSON-representable values, so this survives JSON.stringify/json.loads round-trips without losing meaning.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": ["action", "id", "data"],
|