+ socket.emit('new-notification', notificationMessage)
+ }
+ }
+
+ sendVideoLiveNewState (video: MVideo) {
+ const data: LiveVideoEventPayload = { state: video.state }
+ const type: LiveVideoEventType = 'state-change'
+
+ logger.debug('Sending video live new state notification of %s.', video.url, { state: video.state })
+
+ this.liveVideosNamespace
+ .in(video.id)
+ .emit(type, data)
+ }
+
+ sendVideoViewsUpdate (video: MVideoImmutable, numViewers: number) {
+ const data: LiveVideoEventPayload = { viewers: numViewers, views: numViewers }
+ const type: LiveVideoEventType = 'views-change'
+
+ logger.debug('Sending video live views update notification of %s.', video.url, { viewers: numViewers })
+
+ this.liveVideosNamespace
+ .in(video.id)
+ .emit(type, data)
+ }
+
+ @Debounce({ timeoutMS: 1000 })
+ sendAvailableJobsPingToRunners () {
+ logger.debug(`Sending available-jobs notification to ${this.runnerSockets.size} runner sockets`)
+
+ for (const runners of this.runnerSockets) {
+ runners.emit('available-jobs')