this.liveVideosSocket.emit('subscribe', { videoId })
}
- async unsubscribeLiveVideos (videoId: number) {
+ unsubscribeLiveVideos (videoId: number) {
if (!this.liveVideosSocket) return
this.liveVideosSocket.emit('unsubscribe', { videoId })
})
})
- this.notificationSocket.on('new-notification', (n: UserNotificationServer) => this.dispatchNotificationEvent('new', n))
+ this.notificationSocket.on('new-notification', (n: UserNotificationServer) => {
+ this.ngZone.run(() => this.dispatchNotificationEvent('new', n))
+ })
}
private async initLiveVideosSocket () {
this.liveVideosSocket = this.io(environment.apiUrl + '/live-videos')
})
- const type: LiveVideoEventType = 'state-change'
- this.liveVideosSocket.on(type, (payload: LiveVideoEventPayload) => this.dispatchLiveVideoEvent(type, payload))
+ const types: LiveVideoEventType[] = [ 'views-change', 'state-change' ]
+
+ for (const type of types) {
+ this.liveVideosSocket.on(type, (payload: LiveVideoEventPayload) => {
+ this.ngZone.run(() => this.dispatchLiveVideoEvent(type, payload))
+ })
+ }
}
private async importIOIfNeeded () {