Chat is a websocket based chat system. It's simple but powerful. It can let millions of people chat on line at the same time.
The whole chat system includes two parts: dispatcher and node.
node is responsible for:
1. create connection with clients
2. handle text message, audio message, and image share message
3. broadcast message from client to other clients in same group
dispatcher is responsible for:
1. load data to redis cache from mongo
2. handle nsq events when data in mongo changed, and refresh data in cache
3. check nodes status, add new node, remove dead node
4. dispatch group to node, and balance groups on nodes
5. handle clients requests for node info for logging
Stores data used in system
Cache tool
Message queue, notify dispatcher to refresh data
-
build node
python ./node/build_release.py
-
build dispatcher
python ./dispatcher/build_release.py
If build successfully, binary file will be in dir:
- ./node/release/
- ./dispatcher/release
- run mongo
- run redis
- run nsq
- run dispatcher
- run node
-
system status checker, check if the whole system is running as expected, and output essiential KPI of status
-
message persitent, in case that all messages lost if node restart