SpringBoot中Stomp点对点

@Autowired
private SimpMessagingTemplate template;

    template.convertAndSendToUser(userName, "/queue", msg);

    其中userName不是用SpringSecurity中登录进来的用户,而是自定义的用户。前端期望能够通过URL订阅事件

        var socket = new SockJS('/endpoint');
stompClient = Stomp.over(socket);
stompClient.connect({}, function (frame) {
    stompClient.subscribe('/user/**userName**/queue', function(message){
        console.log(message.body)
    })
});

https://blog.csdn.net/qq_39320953/article/details/77852126