Loom
interface Loom
Establishes a Seam in the role of either an existing-session joiner or a new-session opener. The factory hides discovery (mDNS, MultipeerConnectivity advertising, WebSocket URL).
The single abstract method is weave; host and join are default wrappers. ADR-002.
Usage
Host a session, let a second peer join, and exchange a frame:
Samples
runTest {
val loom = InMemoryLoom()
val host = loom.host(Pattern("Alice"))
val joiner = loom.join(InMemoryTag("Bob"))
// collect one frame from the host's incoming flow
val receivedByHost = async {
host.incoming.first()
}
joiner.broadcast("hello".encodeToByteArray())
val frame = receivedByHost.await()
check(frame.decodeToString() == "hello")
check(frame.sender == joiner.selfId)
host.close()
joiner.close()
}Content copied to clipboard
Inheritors
Functions
Link copied to clipboard
Whether this fabric can be attempted now. Default FabricAvailability.Available; fabrics gated on a runtime capability override.
Link copied to clipboard
Establish a Seam according to rendezvous — either host a new session or join an existing one.