A minimal Spring Boot + Kotlin starter for Lab 4. Complete the tasks in docs/GUIDE.md to implement WebSocket communication with the ELIZA chatbot.
- Spring Boot 3.5.3
 - Kotlin 2.2.10
 - Java 21 (toolchain)
 - Gradle Wrapper
 
- Java 21
 - Git
 
./gradlew clean build
./gradlew test
./gradlew bootRun
# Default: http://localhost:8080src/main/kotlin/websockets: application code (Eliza.kt,ElizaServer.kt)src/test/kotlin/websockets: tests (ElizaServerTest.kt)docs/GUIDE.md: assignment instructions
See docs/GUIDE.md for detailed steps:
- Implement WebSocket server with ELIZA chatbot
 - Handle WebSocket connections and message routing
 - Test WebSocket communication
 
./gradlew ktlintFormat ktlintCheck./gradlew testBe the first to complete at least two of the following tasks to earn a bonus:
- Description: Support STOMP in the server side and create a small client that uses it.
 - Implementation: Implement STOMP protocol support for WebSocket communication and create a client that demonstrates STOMP messaging.
 - Goal: Demonstrate understanding of STOMP protocol and message-oriented communication.
 - Benefit: Shows mastery of advanced WebSocket protocols and messaging patterns.
 
- Description: Support SockJS in the server side and show that polling can be used as transport instead of WebSocket when needed.
 - Implementation: Add SockJS fallback support and demonstrate polling transport when WebSocket is not available.
 - Goal: Ensure WebSocket compatibility across different network environments.
 - Benefit: Enhances application reliability and browser compatibility.
 
- Description: Turn the DOCTOR into a client of the server, so, the server acts only as message broker.
 - Implementation: Refactor the architecture so the server acts as a message broker between multiple ELIZA clients.
 - Goal: Demonstrate understanding of message broker patterns and distributed systems.
 - Benefit: Shows understanding of scalable WebSocket architectures.
 
- Description: Use the server as a relay server to connect to an external message broker (e.g., RabbitMQ).
 - Implementation: Integrate with external message broker and implement relay functionality.
 - Goal: Demonstrate integration with enterprise messaging systems.
 - Benefit: Shows understanding of enterprise messaging patterns and scalability.
 
- Description: Build a real-time dashboard based on WebSocket that displays connection statistics, message rates, and tracks user activity.
 - Implementation: Use WebSocket to stream server metrics to the dashboard UI in real time, providing live updates on WebSocket events and usage.
 - Goal: Showcase real-time visibility into WebSocket server performance and user interactions using WebSocket-based data delivery.
 - Benefit: Demonstrates practical skills in building observability features directly atop the WebSocket protocol.
 
- Description: Add JWT-based authentication for WebSocket connections and implement role-based access control.
 - Implementation: Secure WebSocket handshake, implement token validation, and add authorization for different message types.
 - Goal: Secure WebSocket communication and protect against unauthorized access.
 - Benefit: Shows understanding of WebSocket security patterns and authentication flows.
 
- Description: Design and implement a custom WebSocket subprotocol (e.g., 
chat-history) that supports commands for message persistence and conversation history retrieval. - Implementation: Define subprotocol messages for storing chat content and requesting conversation history. Store messages in a database on specific subprotocol commands, and send back historical data as protocol responses. Optionally, provide alternate REST endpoints for fallback.
 - Goal: Enable robust, protocol-aware conversation persistence and historical data access via subprotocol logic.
 - Benefit: Shows understanding of subprotocol negotiation, protocol design, and combining real-time communication with persistent storage patterns.
 
- Description: Add in-memory session management and implement message broadcasting to all connected WebSocket clients.
 - Implementation: Track active connections using in-memory data structures and broadcast messages to all clients without requiring external coordination.
 - Goal: Demonstrate efficient, server-local handling of broadcasts and session tracking.
 - Benefit: Shows understanding of state management and broadcasting patterns in real-time WebSocket applications without the complexity of distributed deployment.
 
- Description: Use established testing tools for WebSocket applications, including frameworks for load testing and integration tests.
 - Implementation: Employ existing WebSocket test clients and frameworks to run load testing scenarios and automated integration tests.
 - Goal: Ensure WebSocket application reliability and performance.
 - Benefit: Demonstrates proficiency with industry-standard testing tools and strategies for real-time applications.
 
- Description: Add message compression, connection pooling, and performance optimizations for WebSocket communication.
 - Implementation: Implement per-message compression, optimize message serialization, and add connection management.
 - Goal: Optimize WebSocket performance and reduce bandwidth usage.
 - Benefit: Shows understanding of WebSocket performance optimization and efficient real-time communication.
 
Note: unless the goal specifies or disallows a specific framework you are free to replace the framework used in the original implementation with a different framework.