Cloud Client and Server Synchronization Overview

In a Cloud app, the server maintains the current state of the screen being displayed by the client. The client sends events to the server to indicate that the client needs to update. When an event forces the server to change its current screen state, synchronization occurs to transfer the new screen state from the server to the client.

This topic provides an overview of the synchronization process. See also Cloud Synchronization Process: Step by Step.

Sending information from server to client

The server decides which content to display and how to respond to client events. The server is bundled with the Cloud SDK. Although there’s no physical display on the server, the You.i Platform code computes a representation of the visual appearance of the current screen (referred to as the SceneTree). This SceneTree is then packaged and sent to the client over a TCP connection. The packaged message contains an optimized JSON export of the current scene.

Diagram showing how information is sent from server to client in a You.i Roku Cloud app.

Receiving new information on the client

When the server completes the packaging of the updated scene information, it sends that package to the client over the already-established TCP connection. The client reads the JSON and refreshes its screen based on the new information.

Diagram showing how new information is received on the You.i Roku Cloud client.

Sending events from the client to the server

When an event is triggered, for example when a user presses the play button, the client sends a request to the server containing a JSON object describing the action. The server receives that data and takes any action required, such as transitioning to a new screen. That new screen data is packaged and sent back to the client for rendering.

Diagram showing how events are sent from the client to the server in a You.i Roku Cloud app.

To learn more about events, see Cloud Events and Commands Overview.