Client trigger/schedule notification:
POST /notification/create {
"user_id": "123",
"timestamp": datetime,
"type": "PUSH" | "SMS" | "EMAIL",
"query": {}, including parameters for querying notifications from the server
"push_timetsamp": datetime (optional)
} -> create notification object in the database, with initial status.
Client create/update notification settings:
POST/PATCH /notification/settings {
"user_id": "123",
"timestamp": datetime,
"settings": {},
}
Server push notifications to the client (via WebSocket):
POST /notification/push {
"id": "456",
"user_id": "123",
"timestamp": datetime,
} -> push the notification to the client with updated contents (if delivery is confirmed, update status in the database)
Client:
Notification server:
Message queue:
Push server:
Redis cache:
Database:
Notification {
"id": str, - primary key
"user_id": str, - index
"content": {},
"create_time": datetime,
"schedule": datetime, - optional
"status": "UNPUSHED" | "SUCCEED" | "FAILED"
}
User {
"id": str, - primary key
"setting": {}, allow or opt-out for any type of notification, and also rate-limits
}
Scalability:
Latency:
Reliability: