This project integrates WebSockets for real-time chat functionality and Kafka for message processing and other backend operations. It's designed to be platform-agnostic, allowing WebSocket clients from any platform to connect seamlessly.
- WebSocket-Kafka Architecture Diagram:
- WebSocket-Kafka Class Interaction Diagram (Styled):
-
Real-time Chat: Using WebSockets, users can send and receive messages in real-time.
-
Kafka Integration: All chat messages are processed through Kafka, allowing for scalable and reliable message processing.
-
Custom Kafka Operations: Apart from handling chat messages, Kafka is also used for [define your custom operation, e.g., "analyzing chat sentiment", "archiving old chats", etc.].
-
Sliding Windows: To prevent double-spending in Kafka, we've implemented a sliding window mechanism.
-
Platform Agnostic: Whether you're using a web, mobile, or desktop client, our WebSocket integration ensures you can connect to our chat system.
-
Prerequisites: Ensure you have Kafka and a WebSocket server installed and running.
-
Clone the Repository:
git clone https://github.com/FRANKSTEIN11/socket_kafka
-
Navigate to the Project Directory:
cd socket_kafka
-
Start the Server:
run com/yenanren/socket_kafka/SocketKafkaApplication
-
Start the Client (or Start Your Own Client):
run com.yenanren.socket_kafka.client.WebSocketClient1
-
Connect your WebSocket client to WebSocketConst.CHAT_URL
ws://[your-server-address]:[port]
. -
Send a message through the WebSocket client.
-
Kafka will process the message and perform the defined operations.
-
Receive real-time messages and updates on your WebSocket client.
Feel free to fork this repository, make changes, and submit pull requests. Any contributions, whether big or small, are greatly appreciated.
This project is licensed under the MIT License.