# x-dagger **Repository Path**: Wisty317/x-dagger ## Basic Information - **Project Name**: x-dagger - **Description**: 可插拔的Springboot组件 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-12-11 - **Last Updated**: 2026-04-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # x-dagger X-Dagger is a comprehensive instant messaging (IM) and message push solution consisting of server-side components and client SDKs. The project adopts a microservices architecture and supports two mainstream communication protocols: MQTT and WebSocket. It also includes multiple practical Spring Boot Starter components to facilitate quick integration into existing projects. ## Project Structure ``` x-dagger/ ├── x-server-components/ # Server components │ ├── x-server-mqtt/ # MQTT message server │ ├── x-server-websocket/ # WebSocket message server │ ├── x-server-im/ # IM chat service │ └── x-server-crawler/ # Web crawler service ├── x-sdk-components/ # Client SDKs │ ├── x-sdk-mqtt/ # MQTT client SDK │ └── x-sdk-websocket/ # WebSocket client SDK └── x-starter-components/ # Spring Boot starter components ├── x-common/ # Common utilities ├── x-springboot-starter-gateway/ # Gateway component (XSS, CORS) ├── x-springboot-starter-genamer/ # Name generator ├── x-springboot-starter-i18n/ # Internationalization support ├── x-springboot-starter-kaptcha/ # CAPTCHA component ├── x-springboot-starter-log/ # Logging component ├── x-springboot-starter-mongo/ # MongoDB support ├── x-springboot-starter-oss/ # Object storage service ├── x-springboot-starter-redis/ # Redis distributed lock and rate limiting └── x-springboot-starter-restful/ # RESTful response encapsulation ``` ## Core Features ### Message Services - **MQTT Service**: Supports the full MQTT protocol with message publishing/subscribing functionality - **WebSocket Service**: High-performance WebSocket implementation based on T-io, supporting heartbeat detection and reconnection - **IM Chat Service**: Supports storage and querying of chat records ### Starter Components | Component | Description | |---------|-------------| | x-springboot-starter-gateway | XSS protection and CORS configuration | | x-springboot-starter-redis | Distributed lock (`@XLock`), API rate limiting (`@XRateLimit`) | | x-springboot-starter-i18n | Internationalization support with dynamic switching | | x-springboot-starter-kaptcha | CAPTCHA generation service | | x-springboot-starter-log | Request logging via AOP aspect | | x-springboot-starter-oss | Alibaba Cloud OSS object storage integration | | x-springboot-starter-mongo | MongoDB date type conversion support | | x-springboot-starter-genamer | Random Chinese name generation | | x-springboot-starter-restful | Unified response structure encapsulation | ## Technology Stack - **Message Communication**: MQTT (EMQX), WebSocket (T-io) - **Data Storage**: MySQL (MyBatis Plus), TDengine, MongoDB, Redis - **Frameworks**: Spring Boot, Netty - **Tools**: Gson, Lombok ## Quick Start ### Build the Project ```bash mvn clean install -DskipTests ``` ### Start Server Components Each server module is a Spring Boot application; simply run the corresponding `RunApplication` entry class to start the service. ### Use Client SDKs **MQTT Push Example:** ```java MqttClient mqttClient = new MqttClient("tcp://localhost:1883", "your-common-key"); String result = mqttClient.push("client-id", "topic", "message"); ``` **WebSocket Push Example:** ```java WebSocketClient wsClient = new WebSocketClient("ws://localhost:8080", "your-common-key"); WebSocketRequest request = new WebSocketRequest() .setType(SystemPushType.TEXT) .setFromId("user1") .setToId("user2") .setContent("Hello"); String result = wsClient.push(request, "channel1", "channel2"); ``` ### Use Starter Components **Distributed Lock:** ```java @XLock(key = "lock:user:", waitTime = 10000, leaseTime = 30000) public void someMethod() { // Business logic } ``` **API Rate Limiting:** ```java @XRateLimit(limit = 100, timeout = 1000) public void someMethod() { // Business logic } ``` ## License This project is for learning and communication purposes only.