+ const sockets = this.userNotificationSockets[userId]
+ if (!sockets) return
+
+ logger.debug('Sending user notification to user %d.', userId)
+
+ const notificationMessage = notification.toFormattedJSON()
+ for (const socket of sockets) {
+ 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: MVideo) {
+ const data: LiveVideoEventPayload = { views: video.views }
+ const type: LiveVideoEventType = 'views-change'