Skip to content
/ chat Public

websocket based chat system, for millions of users

Notifications You must be signed in to change notification settings

ssor/chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chat

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.

Design

The whole chat system includes two parts: dispatcher and node.

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

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

Requirement

Mongo

Stores data used in system

Redis

Cache tool

Nsq

Message queue, notify dispatcher to refresh data

Build

  1. build node

    python ./node/build_release.py

  2. build dispatcher

    python ./dispatcher/build_release.py

If build successfully, binary file will be in dir:

  • ./node/release/
  • ./dispatcher/release

Run

preparement

  • run mongo
  • run redis
  • run nsq

system

  • run dispatcher
  • run node

Roadmap

  1. system status checker, check if the whole system is running as expected, and output essiential KPI of status

  2. message persitent, in case that all messages lost if node restart

About

websocket based chat system, for millions of users

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published