Transports
Standard Transports
Recommended Design
interface Transport {
// Initialize the Transport with a URI:
constructor(private uriWithConnectionParams: string)
// Open a connection using the URI given in the constructor:
connect(): Promise<void>
// Close the connection:
disconnect(): Promise<void>
// Send an arbitrary payload to the service and all peers:
send(packet: Packet): Promise<void>
// Subscribe to incoming messages from both the service and all peers:
on(event: 'receive', callback: (packet: Packet) => void): void
}Transport URIs
Creating Transports
Learn more
Last updated