routedUnicastRouter

fun routedUnicastRouter(self: PeerId, coreSeam: Seam, lookup: (PeerId) -> PeerId?, scope: CoroutineScope): RoutedUnicastRouter

Build a RoutedUnicastRouter for one server, taking sole ownership of coreSeam's incoming for the routing relay.

Parameters

self

this server's PeerId — the value the directory returns for a player attached here, and the address other servers reach it at over coreSeam. Must equal coreSeam's selfId (the identity this server carries into the core).

coreSeam

this server's seam into the fully-meshed core; the router owns its incoming stream per the single-collection contract — do not run another collector over the same seam.

lookup

the (recipient) -> server directory lookup — pass AttachmentDirectory.lookup. Returns the server a recipient is behind, or null when the recipient is unattached/unknown (the frame is then dropped at the origin).

scope

the CoroutineScope whose Job parents the relay coroutine. Required — no real-dispatcher default; inject a test scope's backgroundScope under virtual time.