socket重复订阅问题修复
This commit is contained in:
parent
0395d6d470
commit
bbf9e9ba0e
@ -37,7 +37,10 @@ StompClient.prototype = {
|
||||
heartbeatOutgoing: 30000,
|
||||
onConnect: () => {
|
||||
this.subscribeMap.forEach(subscribe => {
|
||||
this.clientIns.subscribe(subscribe.dest, subscribe.handler, subscribe.headers);
|
||||
if (!subscribe.sub) {
|
||||
const sub = this.clientIns.subscribe(subscribe.dest, subscribe.handler, subscribe.headers);
|
||||
this.subscribeMap.set(subscribe.dest, {dest: subscribe.dest, handler: onmessage, sub: sub, headers: subscribe.headers, count: 1});
|
||||
}
|
||||
});
|
||||
Notification.closeAll();
|
||||
this.status = true;
|
||||
@ -93,7 +96,6 @@ StompClient.prototype = {
|
||||
|
||||
// 订阅指定的topic
|
||||
subscribe(topic, onmessage, headers) {
|
||||
console.log(topic, onmessage, headers);
|
||||
this.topic = topic;
|
||||
this.onmessage = onmessage;
|
||||
this.headers = headers;
|
||||
|
Loading…
Reference in New Issue
Block a user