Cloud Architecture

A diagram of the architecture of a You.i Roku Cloud app.

The server runs in the Amazon cloud (AWS). When the server starts, it waits and listens for a client to connect to its TCP socket.

When a user starts their Roku channel (a Roku channel is equivalent to an app), the client connects to the server’s TCP socket. This connection persists for the duration of the session. Messages are sent between the client and server in JSON format.

On connection, the client and server perform a handshake to confirm that they’re running compatible versions of their respective code. In addition, the client sends the following data to the server:

  • Device information (such as deviceID)
  • Persistent store (from a previous session)
  • Deep-link parameters, if available
  • In-app purchase details, if available

See also the Cloud Glossary.

The server

The server decides which content to display (including the layout) and how to respond to user requests, like navigation.

The software components in the server are exactly the same ones that would be running on any other platform, with the addition of the Cloud SDK.

A diagram of the server side of a You.i Roku Cloud app.

The server includes most of the application logic for the Cloud app. Some logic and images are run from the client for performance reasons. Static assets, such as images and After Effects (AE) files, are stored in an Amazon S3 bucket and accessed remotely by the client.

A diagram of the components of a You.i Roku Cloud app.

Every time the application code navigates to a new screen, that code computes a visual representation (SceneTree) of that screen. The Cloud SDK monitors the SceneTree and converts it into a SceneGraph and sends it to the client.

When the user presses a button on the Roku’s remote control, the client forwards a request to the server so the server can respond to the button press. If the server determines that a visual change should result (for example, navigating to a new screen), the appropriate information is sent to the client to be rendered.

In most cases, the Cloud SDK passively detects changes to the SceneTree and automatically forwards the information to the client. This means the server code does not need to be specifically written for the Roku platform. The same code that runs natively on other platforms also drives the Roku experience.

The client

The client is very similar to a web browser. A browser forwards user requests to a server, which provides the browser with content to display.

A diagram of the You.i Roku Cloud SceneGraph architecture.

On the Roku device, we run a small, generic app (the client) which, on launch, connects to the server via a TCP socket. Messages are sent between the client and server in JSON format.

A diagram showing You.i Roku Cloud event handling.