Minimized chat demo to ensure the reliability and security of message.
- If you will familiar im project, run it.
- If you will familiar im component function quickly, run it.
.
├── Makefile
├── README.md
├── client
├── server
> First, establish the connection between server and client
> decided on the maximum amount of time you want to allow for a particular logic to complete
> we can implement a timeout machanism
> decied on incoing webscoket message sizeåå
> websocket connection pool
> set idle deadline for conn
> encryption websocket message
> auth when buildding ws connection
> keep-alive for ws connection
> heart beat for ws connection
> healthy network infrastructure
> storage message with no sql database
> use redis cache message seq(hot data)
Notion
if need set ttl for message, can use insertOne with ttl. like
db.yourCollection.insertOne({
content: "Your message content",
createdAt: new Date(), // Current timestamp
expiryTime: new Date(Date.now() + (60 * 60 * 1000)), // Set to expire in 1 hour
});
when build kafka component, set time base retention
kafka-topics.sh --zookeeper localhost:2181 --alter --topic your-topic --config retention.ms=86400000