Skip to content

vlasashk/websocket-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Single group chat

Build

Prerequisites

  • Docker 26.0.0
  • Makefile 3.81
  1. Clone project:
git clone [email protected]:vlasashk/websocket-chat.git
cd websocket-chat
  1. Run:
    1. Server
      make run_server
      
    2. Client
      make run_client
      
  2. 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
Loading

Restrictions/Peculiarities

  • Single chat group - server as a single space for all clients (all clients communicate in a single common space)

Tools used

About

Single group websocket chat service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published