import SockJS from 'sockjs-client';
import Stomp from 'stompjs';
connection() {
// 建立连接对象
this.socket = new SockJS('http://192.168.6.67:8081/endpoint');
this.stompClient = Stomp.over(this.socket);
// 向服务器发起websocket连接
this.stompClient.connect({}, () => {
this.stompClient.subscribe('/user/39/message', (msg) => {
console.log(222)
console.log(msg.body);
});
}, (err) => {
console.log(err)
});
},
不知道我前端这边的东西有没有弄错啊,我使用一对多("/topic/getResponse")的方式是可以的,使用一对一("/user/39/message")的方式就不行,请各位大佬指点指点
请问楼主解决了这个问题吗!