bugfix-修改Centrifuge订阅处理逻辑
This commit is contained in:
parent
d7379d4406
commit
4e8135b471
@ -49,7 +49,9 @@ export class CentrifugeMessagingClient extends MessageClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
subscribe(destination: string, handle: MessageHandler): ISubscription {
|
subscribe(destination: string, handle: MessageHandler): ISubscription {
|
||||||
const sub = this.cli.newSubscription(destination);
|
let sub = this.cli.getSubscription(destination);
|
||||||
|
if (!sub) {
|
||||||
|
sub = this.cli.newSubscription(destination);
|
||||||
sub
|
sub
|
||||||
.on('publication', (ctx) => {
|
.on('publication', (ctx) => {
|
||||||
if (this.options.protocol === 'json') {
|
if (this.options.protocol === 'json') {
|
||||||
@ -65,6 +67,9 @@ export class CentrifugeMessagingClient extends MessageClient {
|
|||||||
console.log('订阅centrifuge服务消息成功', destination, ctx);
|
console.log('订阅centrifuge服务消息成功', destination, ctx);
|
||||||
})
|
})
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
} else {
|
||||||
|
sub.subscribe();
|
||||||
|
}
|
||||||
return sub;
|
return sub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user