Web SDK

Home > rainway-sdk

rainway-sdk package

Classes

ClassDescription
HeldKeysAn interface for querying which keyboard keys are currently held down (locally, on the web page).
RainwayErrorA runtime error that occurred in the Rainway SDK.
RainwayLoggingA class for Rainway SDK logging.To enable logging, call RainwayLogging.setLogSink() with a custom handler. This handler should decide whether a message is worth logging based on its severity level, and then do whatever it wants with the message string (write it to a file, display it, etc.)This should probably be done before instantiating a RainwayRuntime. However, it's also possible to call RainwayLogging.setLogSink() at a later point in time.
RainwayPeerAn object representing a remote Rainway peer.Acquire one of these objects from RainwayRuntime.connect(). Then ask for a stream with RainwayPeer.requestStream().For more info, see: https://docs.rainway.com/tutorial/exchanging-messages https://docs.rainway.com/tutorial/streaming
RainwayRuntimeThe main entry point to the Rainway SDK runtime.To initialize: const runtime = await RainwayRuntime.initialize(config);To connect to a peer by hostname: const peer = runtime.connect(hostname);For more info, see: https://docs.rainway.com/tutorial/what-is-rainway
RainwayStreamAn incoming Rainway stream.To ask a host for a stream, use RainwayPeer.requestStream(). You can also listen for unsolicited streams in RainwayConfig.onStreamAnnouncement. To clean up, call RainwayStream.leave().For more info, see: https://docs.rainway.com/tutorial/streaming
RainwayTransportA base class which can be used to instantiate various network transports.
RTCTransport_2A WebRTC-based transport implementation.

Enumerations

EnumerationDescription
AudioChannels
AudioCodec
AudioContainer
AudioDataType
ButtonActionA flag indicating whether a mouse button went down or up.
FormFactor
GatewayAlertDescriptionRainway Network alert descriptions
GatewayAlertLevelThe severity level of an alert
InputLevelA bitmask of kinds of input a client can control in a stream.
InputType
KeyboardActionA flag indicating whether a keyboard key went down or up.
LogicError
LogLevel
MouseButtonAn enum for buttons on a mouse or touch device.
NetworkProtocol
OperatingSystem
PeerInformationTypeIndicates the type of SDP/ICE message being transported over the Rainway Network for signaling.
PeerState
PeerTransportTypeIndicates the type of transport a peer wishes to open with another
PenFlagsFlags for PenAbsolute.
PenMaskIndicates which fields of PenAbsolute are valid. https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/pen-mask-constants
RainwayChannelMode
RainwayLogLevelRainway's logging severity levels.
RainwayPeerStateA connection state reported by a Rainway peer.
RainwayStreamFit
RainwayTransportStatusThe status of a Rainway transport implementation.
ScrollAxisAn enum for axes that can be scrolled over.
StreamTypeThe type of the stream (full desktop, app isolation, or byofb).
TelemetryValueTypeThe data type of the measure value for a time series data point.
TouchMaskIndicates which fields of TouchAbsolute are valid. https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/touch-mask-constants
VendorA PCI VendorID of a graphics card vendor we recognize.
VideoCodecTypeA bitmask enum coarsely describing a video codec.For H.264 codecs, this is the "profile": https://superuser.com/questions/489087/what-are-the-differences-between-h-264-profilesFor H.265 codecs, this is just an "H265" value for now.
VideoContainer
VideoDataType
VirtualKeyAn enum representing a "virtual key". That is, each member of this enum represents a _behavior_ a key on a keyboard may have (for example "the behavior of the Tab key"), regardless of the physical position of that key (for example "the squat, leftmost key underneath the number row").This coincides with the Windows VirtualKey enum, but in the context of the Rainway Protocol it can be considered platform-independent, and peers should convert to/from it when generating/processing Rainway keyboard messages.See: https://docs.microsoft.com/en-us/uwp/api/windows.system.virtualkey?view=winrt-19041
WindowsPointerFlagsSee https://docs.microsoft.com/en-us/windows/win32/inputmsg/pointer-flags-contants
XInputButtonsA bit-mask enum for buttons on a gamepad.

Functions

FunctionDescription
friendlyGamepadName(gamepad, customMapping)Return a human-readable name for the given gamepad object.This attempts to return an accurate string based on the Bluetooth vendor and product ID, on browsers that put this data in Gamepad.id. On other browsers, or if the vendor and product ID are unrecognized, it will simply return a heuristically cleaned-up version of the Gamepad.id string.

Interfaces

InterfaceDescription
AudioConfigurationAudio configuration for getting decoding info.
DecodingInfoDecoding info result.
FrameDimensions
IAcceptedConnectionRequest
IAcceptJoinRequest_Invoke
IAcceptJoinRequest_Return
IAcceptStreamRequest_Invoke
IAcceptStreamRequest_Return
IArbitraryDatagram
IAudioConfigA combination of an audio codec and containerization format.
IAudioData
IChunkA part of a chunked message.Certain WebRTC implementations cause large packets (>64kB or >256kB) on DataChannels to be dropped, clipped, or split down the middle (rendering their parts individually invalid). To sidestep this, Rainway peers chunk large messages into small enough units whose data fields are reassembled by the remote peer.A receiver stores these chunks, and reinterprets the concatenated data once all parts have been received. (The index values run from 0 to chunksInGroup - 1.)On the Arbitrary channel, reassembled messages are sent to the application, and this struct is in fact the body of ArbitraryDatagram. (A short enough piece of arbitrary data is sent as a group of one chunk.)On the Media channel, reassembled messages are interpreted as MediaDatagram and fed back into the message handler, and chunks occur as the MediaChunk of the MediaBody union.
IClearJoinRequests_Invoke
IClearJoinRequests_Return
IClearLogs_Invoke
IClearLogs_Return
IClearPeerMessages_Invoke
IClearPeerMessages_Return
IClearPeerStateChanges_Invoke
IClearPeerStateChanges_Return
IClearStreamRequests_Invoke
IClearStreamRequests_Return
IClientCapabilitiesA client reports its capabilities to a peer.The "supported" values indicate all configurations that will work for this client, but the "preferred" value will be chosen if possible (e.g. by a host in a 1:1 setting.)
ICodecPackRequestA client requests a codec pack from a peer.
ICodecPackResponseA peer sends a pack of codecs it can use for streaming back to the client.
IConnectionRequest
IDesktopRect
IDeviceInfoInfo about the device a peer is using Rainway from. Peers exchange this freely.
IError_Return
IErrorResponseA client asked for something that the host could not handle.
IGamepadReportA request to bring the remote virtual gamepad with ID "slot" into the state described.
IGamepadRumbleA feedback message, telling a guest about the gamepad rumble motor speed values.
IGatewayAlertAlert messages convey the severity of the message (warning or fatal) and a description of the alert.
IGatewayDatagramRepresents a Gateway datagram.
IGatewayForwardableDefines a message that can be relayed to another peer without a direct connection.
IGatewayHeader
IGatewayHello
IGatewayIdentityThe 'peer hello' message is sent alongside the WebSocket upgrade request as a subprotocol and initiates the Rainway Network handshake.
IGatewayRequestA message directed to the Gateway itself, rather than forwarded to a peer.
IGatewayResponseA response from the Gateway itself, rather than forwarded by it from a peer.
IGatewayResponseContext
IGatewayTrunk
IGetJoinRequests_Invoke
IGetJoinRequests_Return
IGetLogs_Invoke
IGetLogs_Return
IGetPeerId_Invoke
IGetPeerId_Return
IGetPeerMessages_Invoke
IGetPeerMessages_Return
IGetPeerStateChanges_Invoke
IGetPeerStateChanges_Return
IGetStreamRequests_Invoke
IGetStreamRequests_Return
IGetVersion_Invoke
IGetVersion_Return
IGuid
IInitConnectionRequest
IInitialize_Invoke
IInitialize_Return
IInputBodyThe body of an InputDatagram.
IInputDatagram
IInputLevelRequestA client requests a new input level in a host's stream. The response is InputLevelUpdate (the client can check which bits they were or weren't granted).
IInputLevelUpdateA host informs a client of its new input level in a stream.
IJoinRequestOperationRepresents a join request on the E2E host
IJoinStreamA client tells a host that it's interested in its stream, and wishes to start receiving captured media. The host should send a keyframe.
IKeyboardInputA request to perform a remote keypress of the given keycode.
IKeyframeRequestA client asks a host for a keyframe.
ILeaveStreamA client tells a host that it's no longer interested in its stream (i.e. for all it cares, it's okay if the capture session is completely terminated).
IListStreamsA peer is asking another peer to list their streams
ILogEntryRepresents a log entry on the E2E host
ILogicalInputA request to perform a remote text insertion (as if pasting some Unicode text). This is independent of keyboard layout.
ILogicDatagram
IMediaChunkA chunk of a large MediaDatagram. (When all chunks are received, the resulting concatenated buffer is to be reinterpreted as a MediaDatagram.)
IMediaDatagram
IMouseAbsoluteA request to move the remote mouse to an absolute pixel coordinate on the streamed monitor.
IMouseClickA request to click a button on the remote mouse.
IMouseRelativeA request to move the remote mouse by (dx, dy) pixels.
IMouseScrollA request to scroll the remote mouse.
IPauseStreamA client tells a host to pause the stream. The host can temporarily stop sending media until it hears a JoinStream message.
IPeer
IPeerMessageRepresents a peer message on the E2E host
IPeerSignalingInformation
IPeerStateChangeRepresents a peer state change on the E2E host
IPenAbsoluteA request to perform a remote absolute pen movement. https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-pointer\_pen\_info
IPendingConnectionRequest
IPointerDataA packet describing the position and appearance of the remote mouse pointer.A guest receiving such a packet must draw the pointer locally at locally-computed mouse coordinates, as the mouse pointer is not part of the video stream.See: https://www.notion.so/rainway/Pointer-Data-788741724ec9440bbe8c9d3cb785b3f2
IRainwayHeaderA header used by every datagram that goes over the transport from one Rainway peer to another.
IRainwayTelemetryDimensionDimension represents the meta data attributes of the time series. For example, the name and availability zone of an EC2 instance or the organization ID a peer belongs to are dimensions.
IRainwayTelemetryRecordRepresents a time series data point being written into Timestream.
IRainwayTelemetryRequestRepresents a new telemetry event.
IRejectedConnectionRequest
IRejectJoinRequest_Invoke
IRejectJoinRequest_Return
IRejectStreamRequest_Invoke
IRejectStreamRequest_Return
IRejectStreamRequestA would-be host rejects a client stream request.
IRemoteStreamInfoImportant information about a peers stream
IRequestRequests are issued from the E2E test runner to the E2E host
IResponseResponses are issued from the E2E host to the E2E test runner in response to a Request
ISetClipboardTextA request to store some text in the other peer's clipboard.
ISetLogLevel_Invoke
ISetLogLevel_Return
IShutdown_Invoke
IShutdown_Return
IStreamAnnouncementPeer is announcing a stream
IStreamRequestA client asks a host for a stream at the given input level.
IStreamRequestOperationRepresents a stream request on the E2E host
IStreamStoppingA host informs a peer that a stream is stopping.
ITouchAbsolute
ITouchesAbsoluteA request to perform a remote absolute touch movement. https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-pointer\_touch\_info
ITouchPenPointerInfoInformation common to touch and pen events. This is a subset of: https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-pointer\_info
IVideoBitrateRequestA client asks a host for a new video bitrate.
IVideoCodecA video codec recognized by Rainway.
IVideoConfigA combination of a video codec and containerization format.
IVideoData
IViewportResizeA request to resize the streamed application, because the local stream viewport size has changed. Currently this request will be carried out in App Isolation, when one window is isolated. Otherwise it is ignored.
MediaDecodingConfigurationMedia configuration for getting decoding info.
RainwayConfigConfiguration for RainwayRuntime.
RainwayConnectionRequestAn incoming request from a peer who wants to connect to this device.
RainwayCursorA structure which represents a remote cursor.
RainwayFrameVideo frame properties.
RainwayFullscreenOptionsOptions passed into RainwayStream.requestFullscreen().
RainwayStatsRainway transport statistics.
RainwayStreamAnnouncement
VideoConfigurationVideo configuration for getting decoding info.
VideoFrameMetadataVideo frame metadata passed to a videoFrameCallback.

Variables

VariableDescription
AcceptedConnectionRequest
AcceptedConnectionRequestKeyTemplate
AcceptJoinRequest_Invoke
AcceptJoinRequest_Return
AcceptStreamRequest_Invoke
AcceptStreamRequest_Return
ArbitraryDatagram
AudioConfig
AudioData
Chunk
ClearJoinRequests_Invoke
ClearJoinRequests_Return
ClearLogs_Invoke
ClearLogs_Return
ClearPeerMessages_Invoke
ClearPeerMessages_Return
ClearPeerStateChanges_Invoke
ClearPeerStateChanges_Return
ClearStreamRequests_Invoke
ClearStreamRequests_Return
ClientCapabilities
CodecPackRequest
CodecPackResponse
ConnectionRequest
DatagramChannelThe name of the channel nodes will broadcast datagrams to.
DesktopRect
DeviceInfo
Error_Return
ErrorResponse
GamepadReport
GamepadRumble
GatewayAlert
GatewayBody
GatewayDatagram
GatewayForwardable
GatewayForwardableBody
GatewayHeader
GatewayHello
GatewayIdentity
GatewayRequest
GatewayRequestBody
GatewayResponse
GatewayResponseBody
GatewayResponseContext
GatewayTrunk
GetJoinRequests_Invoke
GetJoinRequests_Return
GetLogs_Invoke
GetLogs_Return
GetPeerId_Invoke
GetPeerId_Return
GetPeerMessages_Invoke
GetPeerMessages_Return
GetPeerStateChanges_Invoke
GetPeerStateChanges_Return
GetStreamRequests_Invoke
GetStreamRequests_Return
GetVersion_Invoke
GetVersion_Return
Guid
InitConnectionRequest
Initialize_Invoke
Initialize_Return
InputBody
InputBodyInner
InputDatagram
InputLevelRequest
InputLevelUpdate
Invocation
JoinRequestOperation
JoinStream
KeyboardInput
KeyframeRequest
LeaveStream
ListStreams
LogEntry
LogicalInput
LogicBody
LogicDatagram
MediaBody
MediaChunk
MediaDatagram
MouseAbsolute
MouseClick
MouseRelative
MouseScroll
PauseStream
Peer
PeerKeyTemplateA template that can be formatted to a create peer cache key.
PeerMessage
PeerSetKeyTemplate
PeerSignalingInformation
PeerStateChange
PenAbsolute
PendingConnectionRequest
PendingConnectionRequestKeyTemplate
PointerData
RainwayHeader
RainwayTelemetryDimension
RainwayTelemetryRecord
RainwayTelemetryRequest
RejectedConnectionRequest
RejectJoinRequest_Invoke
RejectJoinRequest_Return
RejectStreamRequest_Invoke
RejectStreamRequest_Return
RejectStreamRequest
RemoteStreamInfo
Request_2
Response_2
Return
SetClipboardText
SetLogLevel_Invoke
SetLogLevel_Return
Shutdown_Invoke
Shutdown_Return
StreamAnnouncement
StreamRequest
StreamRequestOperation
StreamStopping
TelemetryBatchesKeyTemplate
TelemetrySetKey
TouchAbsolute
TouchesAbsolute
TouchPenPointerInfo
VideoBitrateRequest
VideoCodec
VideoConfig
VideoData
ViewportResize

Type Aliases

Type AliasDescription
IGatewayBody
IGatewayForwardableBody
IGatewayRequestBody
IGatewayResponseBody
IInputBodyInnerInner body of an input datagram
IInvocationInvocations represent commands we want the E2E host to execute They can be thought of as simplified versions of the Rainway SDK C ABI
ILogicBodyThe body of a LogicDatagram.
IMediaBodyThe body of a MediaDatagram.
IMediaBodyNotChunk
IRainwayMessage
IReturn
OutgoingInputAn input we're asking to perform in someone's interactive stream.This is a discriminated union type: match on type to distinguish types of input, and then handle the fields of the narrowed type.See: https://basarat.gitbook.io/typescript/type-system/discriminated-unions
PeerId
RainwayLogSinkA Rainway logging callback.