Загрузка...

Chat Application Demo | Websocket | kafka

Scalable Chat System - High-Level Implementation Overview

Project Overview:
This project showcases the development of a scalable chat system inspired by platforms like WhatsApp. It involves the following services:

1. Auth Service:Using JWT for authentication.
2. Frontend with Next.js: Provides the user interface and establishes a WebSocket connection with the backend service.
3. Backend Service: Receives messages from the frontend, stores messages in the database, and publishes messages to Kafka.
4. API Gateway: Acts as a gateway for all APIs in the system.

Technology Stack:
- Database:MongoDB to store usernames and chats.
- Kafka:To handle messages from different clients.

Login Flow:
1. The user enters credentials in the Next.js client.
2. An authentication request is sent to the auth server.
3. The auth server validates the credentials and sets a JWT token in the cookies, which is used for further requests.

Message Flow:
1. The user sends a message, which is transmitted to the backend server via the WebSocket connection.
2. The server checks if the recipient is connected to the same backend server:
- If connected, the message is sent back to that WebSocket.
- If not connected, the server publishes the message to Kafka for that particular message.
3. The server saves the message in the database.
4. Server subscribes to the message channel of all users connected to that server to receive message data from other backend servers.

Видео Chat Application Demo | Websocket | kafka канала Focus_2000
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки

На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.

Об использовании CookiesПринять