如何在Spring Boot Websocket上使用stomp从客户端接收文件作为私人消息?

时间:2019-11-03 04:42:04

标签: java spring-boot spring-websocket stomp sockjs

我编写了以下代码来接收私人短信:

 @MessageMapping("/message.private.{username}")
  public void userSpecificMessage(@DestinationVariable String username, @Payload String 
    payload, Principal principal) throws Exception {
        String username = principal.getName();
        messagingTemplate.convertAndSendToUser(username, "/queue/message", new Test(payload));
    }

如何通过这种方法接收客户端发送的文件?可以使用@Payload接收文件消息吗?请帮帮我,任何与通过stomp和spring websocket发送文件相关的链接将不胜感激。

0 个答案:

没有答案