我已经找到解决方案
@Autowiredprivate SimpMessagingTemplate template;@RequestMapping(value = "/sendMessage")public void sendMessage() throws Exception { this.template.convertAndSend("/topic/greetings", new HelloMessage( (int) Math.random(), "This is Send From Server"));}通过使用此方法,我们可以发送消息以打开WebSocket。
谢谢



