Debugging Cloud Events and Commands

You can debug the client/server events and commands in two ways:

  1. Check the client and server logs.
  2. Use the Cloud Recorder to record the event and command messages.

Client and server logs

The client and server logs can help you debug many types of issues, including the event and command messages. By looking at the logs, you can make sure that the events and commands are being sent and received correctly.

You can also forward the server logs to the BrightScript console so that both the client and server logs appear on the same console.

The following diagram show the ping event and command workflow. Every 10 seconds, the server pings the client, and then the client pings the server. This process verifies the TCP connection status between the client and server.

Diagram showing the ping event and command workflow in a You.i Roku Cloud app.

What to look for

To find the right logs, you can check for specific text.

Event logs

For events, you can look for specific text like Sending {"event": for the client and CYIClientEventHandler on the server.

[2021-10-07 02:38:57.894Z] Sending {"event":"ping"} over TCP connection
2021-10-06 21:38:57.588 rokuApp[53842:1003565] D/CYIClientEventHandler: Handling a ping from client

Command logs

For commands, you can look for specific text like Sending command for the server and processCommand on the client.

2021-10-06 21:38:57.588 rokuApp[53842:1003565] I/ServerCommand: Sending command: (ping) at sequence: 105297801791.
[2021-10-07 02:38:57.939Z] processCommand: ping

Cloud Recorder logs

Using the Cloud Recorder can be helpful, because it contains only event and command logs. This means that you don’t have to filter other types of logs as you do when checking the BrightScript Console and server logs. The Cloud Recorder also contains more details about the event and command messages, like event parameters and command arguments.

To learn how to enable the Cloud Recorder, review the server logs documentation.

What to look for

The Cloud Recorder records all event and command messages and logs those messages to a JSON file. You can find that file in the app root folder (<project>/recording<n>.json>). The <n> filename suffix is a number that starts at zero when the client starts. The number is incremented each time recording is enabled while the server is running.

Event logs

For events, look for the > character at the beginning of each line inside the recording.json file.


Command logs

For commands, look for the < character at the beginning of each line.