From a800dbf345e856ab790e7b3ab9a97e8c5dfa0a32 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 9 Dec 2020 15:00:02 +0100 Subject: Live views update --- server/lib/peertube-socket.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'server/lib/peertube-socket.ts') diff --git a/server/lib/peertube-socket.ts b/server/lib/peertube-socket.ts index 5fc5bc20b..e27963e60 100644 --- a/server/lib/peertube-socket.ts +++ b/server/lib/peertube-socket.ts @@ -69,7 +69,18 @@ class PeerTubeSocket { const data: LiveVideoEventPayload = { state: video.state } const type: LiveVideoEventType = 'state-change' - logger.debug('Sending video live new state notification of %s.', video.url) + 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' + + logger.debug('Sending video live views update notification of %s.', video.url, { views: video.views }) this.liveVideosNamespace .in(video.id) -- cgit v1.2.3