
Server 2 holding space property A so it get data from FA1 and broadcast to clients that join this space. Server 2 and 3 subscribe event FA1 and check if it holding space property A. Server 1 start a timeout and put http request to its queue then it publish an event FA1 via Redis to found server holding space property A. When client is authenticated to access in space, it could listen all notifications in channel but we should not contain too much sensitive data in notification.Ĭlient can ask server to leave channel by send event leave_room and wait until receive leaved_room We can add an authentication step when client ask to join channel but I feel it is unnecessary and complicated. Client need to ask server before join to channel by event join_room and wait until receive joined_room If channel isn’t exist then server will create new one and add client in. When connected to a space, client can join to any channel in space to listen notification in channel. Every time client receive new token, it must emit event authenticate with new JWT to server double check. If it’s expired then send disconnect with reason unauthorized Every time server sends message to client, server will verify client JWT hasn’t expired yet. Otherwise, the server sends authorized event to the client and then start exchanging messages. If an invalid JWT or a space isn’t in the client JWT or a timeout occurs then the server will disconnect client with reason unauthorized. If client send event authenticate with JWT before timeout then server will verify it with space that client want to connect. After client connected, server will set a timeout and wait client send event authenticate.
Client connect to a space (property) of server. With this requirement, Pub/Sub paradigm is suitable Other service can broadcast to all clients in topic, data to broadcast is customizable.
Server can actively disconnect from client for security reason.Client can subscribe more channels at same time or leave channel.Other services want to send notification to clients then send via this central point with easy private API (e.g. A central point to manage incoming clients.Space can have many channels: notifications, tasks, alerts and more and client can choose a channel to subscribe. Each property is a space, client must be authenticated to access a space (using the Altitude JWT).Support more platforms: web, native android & iOS.In the most cases, polling is not good, especially for a long time and with many clients.
How do we add a new task in real-time? We often have 2 options: Push vs Pull (Polling). Example: Android App Pre-check-in and Task generated in Altitude Cloud