RtcLinks

class RtcLinks(site: Site, iceServers: Array<dynamic> = emptyArray())

The links of site over WebRTC data channels, in browsers: to every site opening such links it is introduced to (see Site.onIntroduced), what the two need to connect sent through the sites linked to both (see Site.signal). Of two sites, the one with the lower identifier offers the link. iceServers are those of RTCPeerConnection (none by default: the sites of a local network reach each other without them).

Two sites with no site in common can be paired by hand instead, with no server: one invites, the other accepts the invitation, and the first completes the pairing with the reply. The codes carry all the two need to connect (their whole descriptions, the candidates included), compressed if the browser can.

The frames are sent in chunks of at most CHUNK characters, as data channels bound the size of a message.

Constructors

Link copied to clipboard
constructor(site: Site, iceServers: Array<dynamic> = emptyArray())

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun accept(invitation: String): Promise<String>

The reply to invitation (see invite), for the inviting site to complete the pairing

Link copied to clipboard
fun close()

Closes every link

Link copied to clipboard
fun complete(reply: String): Promise<Unit>

The pairing invited completed with the reply of the other site: once the link is open

Link copied to clipboard

An invitation to pair with this site by hand, for another site to accept