取消订阅后移除Subscription

This commit is contained in:
fan 2023-08-02 13:34:16 +08:00
parent 50f465b24f
commit 9ef7db9925

View File

@ -66,6 +66,10 @@ export class CentrifugeMessagingClient extends MessageClient {
.on('subscribed', (ctx) => { .on('subscribed', (ctx) => {
console.log('订阅centrifuge服务消息成功', destination, ctx); console.log('订阅centrifuge服务消息成功', destination, ctx);
}) })
.on('unsubscribed', (ctx) => {
this.cli.removeSubscription(sub);
console.log('取消订阅centrifuge服务消息成功', destination, ctx);
})
.subscribe(); .subscribe();
} else { } else {
sub.subscribe(); sub.subscribe();