Opening a WebSocket is only the beginning of a conversation between client and server. Suppose a partner console subscribes to export updates and then requests cancellation of an export. If the connection drops before the cancellation response arrives, the console needs to recover its subscriptions and determine whether repeating the command is safe.
The connection alone cannot answer those questions. A usable WebSocket API needs an application protocol: message types, response meanings, subscription rules, and recovery behavior.
This chapter develops that contract for a fictional bookstore service, including authorization, acknowledgments, flow control, and connection shutdown.