Skip to content

five-on-it / packages/protocol/src/memory-transport

packages/protocol/src/memory-transport ​

An in-process transport pair for tests and bots: frames are queued and delivered when MemoryLink.flush is called, so a test controls exactly when the other side sees them (deterministic, no timers). A one-way latency in flushes can be set so lag and reconciliation can be exercised without a network.

A lossy link (LossyOptions) plays a WebRTC data channel that never retransmits: its unreliable frames are lost, delivered twice and held back for a few deliveries (so later frames overtake them), every draw from one seeded generator (@foi/shared's createPrng), so a run is the same every time; its reliable frames arrive as they were sent. Its ends say so (lossy).

Interfaces ​

Functions ​