Web SDK - RainwayConfig

Home > rainway-sdk > RainwayConfig

RainwayConfig interface

Configuration for RainwayRuntime.


export interface RainwayConfig 


apiKeystringThe Rainway API key of your organization.
externalId?string(Optional) An identifying string that your application can recognize and tie back to a user. (For example, a username.)Defaults to the empty string.
logSink?(level: RainwayLogLevel, message: string) => void(Optional) Called by the Rainway SDK for logging. In your implementation of this callback, you can redirect the log messages to a file, or console.log, or anywhere else.
onConnectionRequest(runtime: RainwayRuntime, request: RainwayConnectionRequest) => voidCalled when a remote peer wishes to connect to this peer.Use RainwayConnectionRequest.accept or RainwayConnectionRequest.reject to process the request.
onPeerDataChannel(runtime: RainwayRuntime, peer: RainwayPeer, channel: string, event: RTCDataChannelEvent) => voidCalled when a remote peer opens a Data Channel.
onPeerError(runtime: RainwayRuntime, peer: RainwayPeer, error: RainwayError) => voidCalled when a remote peer encountered a fatal error.RainwayError.message explains what went wrong.
onPeerMessage(runtime: RainwayRuntime, peer: RainwayPeer, channel: string, data: Uint8Array) => voidCalled when a remote peer sends an application message over a Data Channel.
onPeerStateChange(runtime: RainwayRuntime, peer: RainwayPeer, state: RainwayPeerState) => voidCalled when a new peer-to-peer connection is initiated (state == New) or when its connectivity state changes (see RainwayPeerState values).
onRuntimeConnectionLost(runtime: RainwayRuntime, error: RainwayError) => voidThis function is called when connection to the Rainway Network is lost.All peer connections should be considered invalidated and must be re-established. The Rainway Network connection itself will be automatically re-established on the next call to RainwayRuntime.connect.
onStreamAnnouncement(runtime: RainwayRuntime, peer: RainwayPeer, announcement: RainwayStreamAnnouncement) => voidCalled when a remote peer has a media stream it wants this peer to know about.Use RainwayStreamAnnouncement.join to start consuming the stream.
onStreamStop(runtime: RainwayRuntime, stream: RainwayStream) => voidCalled when a remote peer ends its stream.Use RainwayStream.host to figure out which peer's stream it is.
preventUnloadingPage?boolean(Optional) Prevent unloading the page during a stream. (Show a "really leave this page?" prompt in response to a user pressing e.g. the back button while streaming.)Defaults to "true".