Designing a WebSocket interaction
In this section, we’ll start by describing the sharing workflow, then we’ll look at the new UI elements that support this workflow, and finally we’ll walk through the code changes you’ll make in this chapter.
The sharing workflow
A sharing session is made up of one presenter and zero or more watchers. That means there are two modes that the app can be in: either presenting or watching.
When the app is in presenting mode, then everyone watching will get a copy of your Spec Logo instructions. All your instructions are sent to the server via a WebSocket.
When your app is in watching mode, a WebSocket receives instructions from the server and immediately outputs them onto your screen.
The messages sent to and from the server are simple JSON-formatted data structures.
Figure 16.1 shows how the interface looks when it’s in presenter mode.
Figure 16.1 – Spec Logo in presenter...