npm package: @pureweb/platform-streaming-agent
Description: The PureWeb platform streaming agent enables your game to communicate and stream through the PureWeb Platform
Author: PureWeb
Latest version: 5.0.5

# Platform Streaming Agent

The PureWeb platform streaming agent enables your game to communicate and stream through the PureWeb Platform

## Install the PureWeb CLI and Streaming Agent

Using yarn:
```shell
$ yarn global add @pureweb/platform-cli
$ yarn global add @pureweb/platform-streaming-agent
```
Using npm:
```shell
$ npm install -g @pureweb/platform-cli
$ npm install -g @pureweb/platform-streaming-agent
```

## Access the PureWeb Developer Console
* Navigate to https://console.pureweb.io
* Login (or signup) and create a new project.

## Setup CLI credentials
* From the console, select the *gear* icon from the top menu to access project properties.
* Enable `anonymous access`
*  From the project settings, select the `Platform CLI` tab. Copy the commands and run them in a console.

## For local development, without a published model
* Copy the `Default Environment` from the *Project Properties* dialog
* Use the cli to request an agent token:
`pw agent create --environmentId <your default environment id>`
```
👁   pw agent create --environmentId 12345-6789-1234-5678-123456733212389
{
  "access_token": "ey...iw8rq2Wk",
  "expires_in": 86400,
  "token_type": "Bearer"
}
```

Set the `PUREWEB_AGENT_TOKEN` environment variable. This will vary between operating systems and shells.
* Windows PowerShell: `$env:PUREWEB_AGENT_TOKEN="<access_token>"`
* Windows Command: `set PUREWEB_AGENT_TOKEN=<access_token>`
* OSX / Linux Bash: `export PUREWEB_AGENT_TOKEN=<access_token>`

### Optional for Unreal
 You can change the default port. For Unity, use 9210. For Unreal, you can skip this step. Set the PUREWEB_STREAMER_PORT environment variable.
* Windows PowerShell: `$env:PUREWEB_STREAMER_PORT=9210`
* Windows Command: `set PUREWEB_STREAMER_PORT=9210`
* OSX / Linux Bash: `export PUREWEB_STREAMER_PORT=9210`

Run the streaming-agent:
```
👁   streaming-agent
┌──────────────────────────────────────────────────────────┐
│                                                          │
│   PureWeb Streaming Agent 2.2.1                          │
│                                                          │
│   Agent id:       e5b1b35a-c60b-45fb-89a4-dd2788620644   │
│   Project id:     bea3c4cb-efa5-4041-9485-6e7a2b49e6d3   │
│   Environment id: 12345-6789-1234-5678-123456733212389   │
│                                                          │
│   Streamer Port:   8888                                  │
│   Leasing Enabled: NO                                    │
│   Sidecar Port:    NO                                    │
│                                                          │
│   Timeouts                                               │
│                                                          │
│     Rendezvous:    NO                                    │
│     Linger:        NO                                    │
│                                                          │
│                                                          │
└──────────────────────────────────────────────────────────┘
```
* Start your Unreal game: `game.exe -PixelStreamingPort=8888 -PixelStreamingIP=127.0.0.1`
* View (and share) your application in the preview client: `https://preview.pureweb.io/<project id>?environmentId=<environment id>&local=true`

## Support
Contact support@pureweb.com with any questions or concerns.