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 {
|
||||
const sub = this.cli.newSubscription(destination);
|
||||
let sub = this.cli.getSubscription(destination);
|
||||
if (!sub) {
|
||||
sub = this.cli.newSubscription(destination);
|
||||
sub
|
||||
.on('publication', (ctx) => {
|
||||
if (this.options.protocol === 'json') {
|
||||
@ -65,6 +67,9 @@ export class CentrifugeMessagingClient extends MessageClient {
|
||||
console.log('订阅centrifuge服务消息成功', destination, ctx);
|
||||
})
|
||||
.subscribe();
|
||||
} else {
|
||||
sub.subscribe();
|
||||
}
|
||||
return sub;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user