git clone git@github.com:vlasashk/websocket-chat.git
cd websocket-chat
Run:
Server
make run_server
Client
make run_client
Tests with coverage:
make test_server
Project information
Architecture
sequenceDiagram
participant C as Client
participant S as Server
participant R as Redis
participant K as Kafka
participant SS as Storage Service
participant P as Postgres DB
C->>+S: Connect via Websocket
S->>+SS: HTTP /register
SS->>+P: Store user nickname
P-->>-SS: Return user ID
SS-->>-S: Return user ID
S->>+R: Fetch last 10 messages from cache
R-->>-S: Return messages
S-->>-C: Send last 10 cached messages
loop Each Message
C->>+S: Send message
S->>+R: Cache message
R-->>-S: Confirm cache update
S->>+K: Forward message to Kafka
S-->>-C: Broadcast message to all clients
K->>+SS: Pass message to Storage Service
SS->>+P: Store message in Postgres
end
note over S: Caches last 10 messages
Restrictions/Peculiarities
Single chat group - server as a single space for all clients (all clients communicate in a single common space)