https://www.jianshu.com/p/4ef5004a1c81
https://blog.csdn.net/u013627689/article/details/73611945
https://blog.csdn.net/shuaicihai/article/details/75210704
https://blog.csdn.net/u012702547/article/details/53816326
https://www.cnblogs.com/jmcui/p/8999998.html
https://www.cnblogs.com/winkey4986/p/5622758.html
https://blog.csdn.net/jqsad/article/details/77745379
https://yq.aliyun.com/articles/476079
点对点问题:
1.配置:
js里使用 /user/userId/queue/message收不到订阅消息,使用下面的可以
2.配置:
js里使用 /user/userId/message可以收到
https://blog.csdn.net/u013627689/article/details/73611945
https://blog.csdn.net/shuaicihai/article/details/75210704
https://blog.csdn.net/u012702547/article/details/53816326
https://www.cnblogs.com/jmcui/p/8999998.html
https://www.cnblogs.com/winkey4986/p/5622758.html
https://blog.csdn.net/jqsad/article/details/77745379
https://yq.aliyun.com/articles/476079
点对点问题:
1.配置:
registry.enableSimpleBroker("/topic","/queue"); //这句表示在topic和user这两个域上可以向客户端发消息;
registry.setApplicationDestinationPrefixes("/app") ;// 这句表示客户端向服务端发送时的主题上面需要加"/app"作为前缀;
registry.setUserDestinationPrefix("/user/"); // 这句表示给指定用户发送(一对一)的主题前缀是“/user/”;
controller 使用 @SendToUser("/queue/message")
js里使用 /user/userId/queue/message收不到订阅消息,使用下面的可以
stomp.subscribe('/user/queue/message', function(message){
console.log("message2:" + message);
var obj = JSON.parse(message.body);
console.log("admin返回用户特定的消息2:" + obj.code +" msg===" + obj.msg);
});
2.配置:
registry.enableSimpleBroker("/topic","/user"); //这句表示在topic和user这两个域上可以向客户端发消息;
registry.setApplicationDestinationPrefixes("/app") ;// 这句表示客户端向服务端发送时的主题上面需要加"/app"作为前缀;
registry.setUserDestinationPrefix("/user/"); // 这句表示给指定用户发送(一对一)的主题前缀是“/user/”;
controller 使用 @SendToUser("/message")
js里使用 /user/userId/message可以收到
stomp.subscribe('/user/"+userId+"/message', function(message){
console.log("message2:" + message);
var obj = JSON.parse(message.body);
console.log("admin返回用户特定的消息2:" + obj.code +" msg===" + obj.msg);
});