Skip to content

Commit dc957dd

Browse files
authored
Merge pull request #1439 from bbc/fix/live-status-gateway-subscription-check
2 parents 1417440 + 56823de commit dc957dd

File tree

1 file changed

+4
-3
lines changed
  • packages/live-status-gateway/src/topics

1 file changed

+4
-3
lines changed

packages/live-status-gateway/src/topics/root.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,13 @@ export class RootChannel extends WebSocketTopicBase implements WebSocketTopic {
7171
}
7272

7373
addTopic(channel: string, topic: WebSocketTopic): void {
74-
if (channel in SubscriptionName) this._topics.set(channel, topic)
74+
if (Object.values<string>(SubscriptionName).includes(channel)) this._topics.set(channel, topic)
7575
}
7676

7777
subscribe(ws: WebSocket, name: SubscriptionName, reqid: number): void {
7878
const topic = this._topics.get(name)
79-
const curUnsubscribed = topic && !topic.hasSubscriber(ws) && name in SubscriptionName
79+
const curUnsubscribed =
80+
topic && !topic.hasSubscriber(ws) && Object.values<string>(SubscriptionName).includes(name)
8081
if (curUnsubscribed) {
8182
this.sendMessage(
8283
ws,
@@ -108,7 +109,7 @@ export class RootChannel extends WebSocketTopicBase implements WebSocketTopic {
108109

109110
unsubscribe(ws: WebSocket, name: SubscriptionName, reqid: number): void {
110111
const topic = this._topics.get(name)
111-
const curSubscribed = topic && topic.hasSubscriber(ws) && name in SubscriptionName
112+
const curSubscribed = topic && topic.hasSubscriber(ws) && Object.values<string>(SubscriptionName).includes(name)
112113
if (curSubscribed) {
113114
topic.removeSubscriber(ws)
114115
this.sendMessage(

0 commit comments

Comments
 (0)