刘勇虎的官方网站
网站内容包含大前端、服务器开发、Python开发、iOS开发、Android开发、网站维护等技术文章。专注于分享技术经验,职业心得体会,IT优秀文章与教程创作。
Stay hungry,Stay foolish,Stay young
console.log("VUE_APP_STOMP_URL ", process.env.VUE_APP_STOMP_URL);
if (this.stompClient === null) {
this.stompClient = Stomp.client(process.env.VUE_APP_STOMP_URL);
// console.log("this.stompClient ", JSON.stringify(this.stompClient));
const client = this.stompClient;
client.connect({ username: "1" }, function(frame) {
console.log("连接服务端成功");
console.log("Connected: " + frame);
console.log("this.stompClient ", JSON.stringify(client));
client.subscribe("/queue/trafficQueue", function(m) {
// reply by sending the reversed text to the temp queue defined in the "reply-to" header
var reversedText = m.body
.split("")
.reverse()
.join("");
// client.send('/topic/test', {"content-type":"text/喷脸ain"}, reversedText);
console.log("收到消息:" + m.body);
});
});
}
{
"ws": {},
"counter": 0,
"connected": false,
"heartbeat": { "outgoing": 10000, "incoming": 10000 },
"maxWebSocketFrameSize": 16384,
"subscriptions": {}
}
{
"ws": {},
"counter": 0,
"connected": true,
"heartbeat": { "outgoing": 10000, "incoming": 10000 },
"maxWebSocketFrameSize": 16384,
"subscriptions": {},
"serverActivity": 1615433916730,
"pinger": 32,
"ponger": 33
}