Understanding how the Channel API works
The Channel API basically consists of the following elements:
- Channel: This is a one-way communication path between the server and a JavaScript client. There is exactly one channel for each client and the server uses it to dispatch messages.
- Client ID: This is a string that identifies individual JavaScript clients on the server. We can specify any string as the Client ID, for example, the identifier of the current user.
- JavaScript client: The client is responsible for connecting to a specific channel, listening to updates on the channel itself, and sending messages to the server via HTTP requests.
- Server: The server is responsible for creating channels for each JavaScript client connected, providing access tokens to authenticate connections, receiving messages from the client via HTTP requests, and sending updates through the channels.
The first step for using the Channel API is delivering the JavaScript client to our users and building the code into...