HomeGuidesAPI Reference
HubBlogChangelogSupport ForumLog In
API Reference

Web SDK - RainwayConnection

Home > @rainway/web > RainwayConnection

RainwayConnection class

A connection to the Rainway network over which peer connection requests are transmitted.

Signature:

export declare class RainwayConnection extends EventEmitter<RainwayConnectionEvents> 

Extends: EventEmitter<RainwayConnectionEvents>

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the RainwayConnection class.

Properties

PropertyModifiersTypeDescription
externalIdstring | undefinedThe optional user-specified string identifying the local peer.
idPeerIdA numeric ID identifying the local peer.A Peer ID identifies a Rainway peer to other peers, and on web is persisted in LocalStorage.
peersReadonlyArray<Peer>

Methods

MethodModifiersDescription
cancelConnectionAttempt(peerId)Cancel the pending connection attempt to a hostname, if there is one.
close()Disconnect, remove listeners and clean up internal state.
connect(peerId)Connect to another peer on the Rainway Network.