---
agentTools:
  projectIndex: https://docs.rainway.com/llms.txt
---

# Streaming

# Streaming

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

[block:callout]
{
  "type": "warning",
  "body": "In its current beta state, the Rainway SDK only supports streams\n* **from** a Windows desktop, using the Native Runtime,\n* **to** a web browser, using the Web Runtime.\n\nSo make sure you have both of these set up if you want to try out streaming.\n\nIf you want to try streaming without writing any code yourself, you can install the <a href=\"https://github.com/RainwayApp/rainway-sdk-csharp-examples/tree/main/service-example\">C# demo</a> on a Windows desktop, and use the <a href=\"https://sdk-builds.rainway.com/demos/web/\">web demo page</a> to connect to it from a browser on another computer.",
  "title": "Platform limitations on streaming"
}
[/block]

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 `Peer` as an event, named "stream-request". The host specifies the configuration for the stream, optionally considering what the peer requested.

[block:code]
{
  "codes": [
    {
      "code": "peer.addEventListener(\"stream-request\", async (ev) => {\n  // who's requesting the stream\n  const requesterId = ev.id;\n  \n  // what input level are they requesting\n  const requesterPerms = ev.permissions;\n  \n  // we can choose to accept or reject, here we'll accept\n  // the returned promise resolves to an OutboundStream object\n  const stream = await ev.accept({\n    // grant them what they asked for\n    permissions: requesterPerms,\n    \n    // share the full desktop\n    type: RainwayStreamType.FullDesktop\n\t});\n});",
      "language": "typescript"
    }
  ]
}
[/block]

Calling `accept` will start streaming media to the web app, which it can display in a container on the page. It returns a Promise that resolves to an `OutboundStream` that can be used to further control the stream session.

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