Here's how to stream an interactive Windows desktop from one Peer to another.


Platform limitations on streaming

In its current beta state, the Rainway SDK only supports streams

  • from a Windows desktop, using the Native Runtime,
  • to a web browser, using the Web Runtime.

So make sure you have both of these set up if you want to try out streaming.

If you want to try streaming without writing any code yourself, you can install the C# demo on a Windows desktop, and use the web demo page to connect to it from a browser on another computer.

Before a stream is initiated, the peer-to-peer connection is symmetrical. Once streaming begins, this changes. The streaming Peer (native app) is referred to as the host, and the Peer consuming the stream (the host's web app) is the client.

A desktop stream may be initiated when a client requests it. Here's what that looks like.

Requested streams

Stream requests come in on the onStreamRequest handler passed into the host's RainwayConfig.

The host specifies which input permissions to grant, and which processes to stream:

config.onStreamRequest = [this](const auto& request) {
    // Accept the request:
    RainwayStreamConfig cfg;
    cfg.inputLevel = Rainway::InputLevel::Gamepad | Rainway::InputLevel::Mouse;
    cfg.isolateProcessIds = {}; // empty = stream the whole desktop

    // Or reject it:

Calling accept will start streaming media to the web app, which it can display in a container on the page.

Alternatively, the host can call reject with a human-readable reason string.