@Controller
public class WebSocketController {
// publisher send message to --> "/channel/chat"
// --> broker relay it to --> "/topic/messages"
// --> broker push it to all subscribers
@MessageMapping("/chat")
@SendTo("/topic/messages")
public OutputMessage send(Message message) throws Exception {
String time = new SimpleDateFormat("HH:mm").format(new Date());
return new OutputMessage(message.getFrom(), message.getText(), time);
}
}