websocket-project-backend/src/main/java/com/hselmi/websocketproject/ChatController.java
@MessageMapping("/sendmsg")
    // the return value is broadcast to all subscribers of /chat/messages
    @SendTo("/chat/messages")
    public ChatMessage chat(ChatMessage message) throws Exception {
        Thread.sleep(1000); // simulated delay
        return new ChatMessage(message.getText(), message.getUsername(), message.getAvatar());
    }
// mapped to handle chat messages to the /sendmsg destination
mapped to handle chat messages to the /sendmsg destination
mapped to handle chat messages to the / sendmsg destination
@MessageMapping("/sendmsg")
    @SendTo("/chat/messages")
    public ChatMessage chat(ChatMessage message) throws Exception {
        Thread.sleep(1000); 
        return new ChatMessage(message.getText(), message.getUsername(), message.getAvatar());
    }
@ MessageMapping ( "/sendmsg" ) @ SendTo ( "/chat/messages" ) public ChatMessage chat ( ChatMessage message ) throws Exception { Thread . sleep ( 1000 ) ; return new ChatMessage ( message . getText ( ) , message . getUsername ( ) , message . getAvatar ( ) ) ; }
mapped to handle chat messages to the /sendmsg destination
mapped to handle chat messages to the / sendmsg destination
// the return value is broadcast to all subscribers of /chat/messages // simulated delay