@johnhenry/wsh 0.6.0 → 0.7.0
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/package.json +1 -1
- package/src/index.mjs +2 -2
- package/src/transport-ws.mjs +18 -0
package/package.json
CHANGED
package/src/index.mjs
CHANGED
|
@@ -49,8 +49,8 @@ export {
|
|
|
49
49
|
} from './auth.mjs';
|
|
50
50
|
|
|
51
51
|
// Transport
|
|
52
|
-
export { WshTransport, WebTransportTransport } from './transport.mjs';
|
|
53
|
-
export { WebSocketTransport } from './transport-ws.mjs';
|
|
52
|
+
export { WshTransport, WebTransportTransport, dispatchSerially, SerialQueue } from './transport.mjs';
|
|
53
|
+
export { WebSocketTransport, WS_FRAME_TYPE } from './transport-ws.mjs';
|
|
54
54
|
|
|
55
55
|
// Session + Client
|
|
56
56
|
export { WshSession } from './session.mjs';
|
package/src/transport-ws.mjs
CHANGED
|
@@ -29,6 +29,24 @@ const FRAME_DATA = 0x02;
|
|
|
29
29
|
const FRAME_OPEN_STREAM = 0x03;
|
|
30
30
|
const FRAME_CLOSE_STREAM = 0x04;
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* The mux frame-type byte values, exported for anything outside this
|
|
34
|
+
* module that needs to name or inspect them correctly — tooling,
|
|
35
|
+
* logging, or an alternative from-scratch implementation of this
|
|
36
|
+
* transport in another runtime, which needs these exact wire values to
|
|
37
|
+
* interoperate. Not related to `MSG` (messages.gen.mjs): that's the
|
|
38
|
+
* CBOR-layer protocol-message opcode space carried *inside* a
|
|
39
|
+
* FRAME_CONTROL payload, a separate numbering space at a different
|
|
40
|
+
* layer of the stack. (An earlier, since-removed `MSG.WS_DATA` conflated
|
|
41
|
+
* the two and collided with a real MSG opcode — see CHANGELOG 0.6.0.)
|
|
42
|
+
*/
|
|
43
|
+
export const WS_FRAME_TYPE = Object.freeze({
|
|
44
|
+
CONTROL: FRAME_CONTROL,
|
|
45
|
+
DATA: FRAME_DATA,
|
|
46
|
+
OPEN_STREAM: FRAME_OPEN_STREAM,
|
|
47
|
+
CLOSE_STREAM: FRAME_CLOSE_STREAM,
|
|
48
|
+
});
|
|
49
|
+
|
|
32
50
|
// ── Header helpers ───────────────────────────────────────────────────
|
|
33
51
|
|
|
34
52
|
const HEADER_SIZE = 5; // 1 byte type + 4 bytes stream ID
|