transport-io 0.2.0 → 0.3.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/README.md CHANGED
@@ -8,10 +8,14 @@
8
8
  Real-time apps over WebTransport. Socket.IO's shape, on a transport with multiple streams
9
9
  and datagrams, without Socket.IO's mistakes.
10
10
 
11
- Framing, length prefixes, buffer accumulation, stream lifecycle and backpressure queues are
12
- hidden. Reliability is not: an event declares `reliable` or `unreliable` in the contract, and
13
- "this message may be dropped" is a property of your data that lives in the type system. The
14
- reliable lane is carried on QUIC streams, the unreliable lane on QUIC datagrams.
11
+ Framing, length prefixes, buffer accumulation and stream lifecycle are hidden. Reliability is
12
+ not: an event declares `reliable` or `unreliable` in the contract, and "this message may be
13
+ dropped" is a property of your data that lives in the type system. The reliable lane is
14
+ carried on QUIC streams, the unreliable lane on QUIC datagrams.
15
+
16
+ A request answers with a value or with a **sequence**. `call()` awaits one result;
17
+ `stream()` gives an async iterable, and `break` resets the QUIC stream so the server
18
+ generator's `finally` runs. Cancellation costs no extra API.
15
19
 
16
20
  **Read [KNOWN-ISSUES.md](https://github.com/transport-io/transport-io/blob/main/KNOWN-ISSUES.md)
17
21
  before you start.** It is what this library refuses to do and will not change, plus the one
@@ -23,8 +27,10 @@ measured defect. Full documentation is in the
23
27
  - **Chrome and Firefox.** Safari cannot talk to a quiche-backed server and is unsupported.
24
28
  - **The server needs a separate native install**, and its Linux prebuild needs glibc 2.38 -
25
29
  no default Node `-slim` image has it, and Alpine has no prebuild at all.
26
- - **Each `call()` leaks ~5.95 KB of server memory**, upstream in the QUIC binding, not in
27
- this library. `emit` and datagrams are flat.
30
+ - **Each bidirectional stream leaks ~5.95 KB of server memory**, upstream in the QUIC
31
+ binding, not in this library. `emit` and datagrams are flat. The leak is per stream rather
32
+ than per message, so a `stream()` of a thousand tokens costs 5.95 KB in total where a
33
+ thousand `call()`s cost 5.95 KB each: for token workloads, streaming is the cheap shape.
28
34
  - **The protocol is v0 and unstable.** Both sides currently require an exact match.
29
35
 
30
36
  ```bash
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  export { type Adapter, type BroadcastOptions, type Frame as AdapterFrame, MemoryAdapter, type MemoryBus, memoryBus, type PeerId, type RemoteEnvelope, } from './adapter.ts';
2
2
  export { Client, type ClientOptions, type ClientState, type Status } from './client.ts';
3
- export { type AnyMap, type CallableOf, type Contract, defineContract, type EventDef, type EventShape, type Infer, type Lane, type MapOf, type Schema, type$, } from './contract.ts';
3
+ export { type AnyMap, type CallableOf, type Contract, defineContract, type EventDef, type EventShape, type Infer, type Lane, type MapOf, type Schema, type StreamableOf, type$, } from './contract.ts';
4
4
  export { maxDatagramPayload } from './datagram.ts';
5
5
  export { TransportError, type TransportErrorCode } from './errors.ts';
6
6
  export { encodeFrame, type Frame, FrameDecoder, maxPayloadFor } from './framer.ts';
7
7
  export { CloseCode, Codec, DATAGRAM_CONSERVATIVE_PAYLOAD_MAX, DATAGRAM_HEADER_BYTES, EVENT_ID_NOT_APPLICABLE, FrameType, MAX_CALL_PAYLOAD_BYTES, MAX_EMIT_PAYLOAD_BYTES, PROTOCOL_VERSION, ResetCode, STREAM_FRAME_OVERHEAD_BYTES, } from './protocol.ts';
8
8
  export { createServer, type RoomTarget, Server, type ServerOptions, type ServerPeer, } from './server.ts';
9
- export type { SessionStats } from './session.ts';
9
+ export type { SessionStats, StreamResult } from './session.ts';
10
10
  /**
11
11
  * Hand-maintained and asserted against `package.json` by `index.test.ts`, because
12
12
  * `isolatedDeclarations` forbids inferring it from an import and a version that drifts from
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,KAAK,IAAI,YAAY,EAC1B,aAAa,EACb,KAAK,SAAS,EACd,SAAS,EACT,KAAK,MAAM,EAKX,KAAK,cAAc,GACpB,MAAM,cAA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,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;AACvF,OAAO,EACL,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,cAAc,EACd,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,GACN,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAClF,OAAO,EACL,SAAS,EACT,KAAK,EACL,iCAAiC,EACjC,qBAAqB,EACrB,uBAAuB,EACvB,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,SAAS,EACT,2BAA2B,GAC5B,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,YAAY,EACZ,KAAK,UAAU,EACf,MAAM,EACN,KAAK,aAAa,EAClB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,MAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -14,5 +14,5 @@ export { createServer, Server, } from './server.js';
14
14
  * `changeset version` moves the manifest, so this moves in the same commit - which the test
15
15
  * enforces rather than trusting anyone to remember.
16
16
  */
17
- export const VERSION = '0.2.0';
17
+ export const VERSION = '0.3.0';
18
18
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EAEb,S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MAAM,GAGP,MAAM,aAAa,CAAA;AAGpB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAW,OAAO,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "transport-io",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Real-time apps over WebTransport. Two lanes, one contract, no fallback.",
5
5
  "license": "MIT",
6
6
  "type": "module",