diff options
author | Chocobozzz <me@florianbigard.com> | 2020-12-10 10:20:04 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-12-10 10:20:04 +0100 |
commit | dc1f314efdae14f838c109ebbc1e8d69273d0319 (patch) | |
tree | ea1eff931e3416a8db25b2bf1187cb44020b4553 /client/src/app/core/notification/peertube-socket.service.ts | |
parent | e43b5a3fa887e82e32ac43a9736cf2c784fb7717 (diff) | |
download | PeerTube-dc1f314efdae14f838c109ebbc1e8d69273d0319.tar.gz PeerTube-dc1f314efdae14f838c109ebbc1e8d69273d0319.tar.zst PeerTube-dc1f314efdae14f838c109ebbc1e8d69273d0319.zip |
Fix socket io with angular
Diffstat (limited to 'client/src/app/core/notification/peertube-socket.service.ts')
-rw-r--r-- | client/src/app/core/notification/peertube-socket.service.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/client/src/app/core/notification/peertube-socket.service.ts b/client/src/app/core/notification/peertube-socket.service.ts index 089276cfc..bc3f7b893 100644 --- a/client/src/app/core/notification/peertube-socket.service.ts +++ b/client/src/app/core/notification/peertube-socket.service.ts | |||
@@ -58,9 +58,12 @@ export class PeerTubeSocket { | |||
58 | this.notificationSocket = this.io(environment.apiUrl + '/user-notifications', { | 58 | this.notificationSocket = this.io(environment.apiUrl + '/user-notifications', { |
59 | query: { accessToken: this.auth.getAccessToken() } | 59 | query: { accessToken: this.auth.getAccessToken() } |
60 | }) | 60 | }) |
61 | |||
62 | this.notificationSocket.on('new-notification', (n: UserNotificationServer) => { | ||
63 | this.ngZone.run(() => this.dispatchNotificationEvent('new', n)) | ||
64 | }) | ||
61 | }) | 65 | }) |
62 | 66 | ||
63 | this.notificationSocket.on('new-notification', (n: UserNotificationServer) => this.dispatchNotificationEvent('new', n)) | ||
64 | } | 67 | } |
65 | 68 | ||
66 | private async initLiveVideosSocket () { | 69 | private async initLiveVideosSocket () { |
@@ -76,7 +79,9 @@ export class PeerTubeSocket { | |||
76 | const types: LiveVideoEventType[] = [ 'views-change', 'state-change' ] | 79 | const types: LiveVideoEventType[] = [ 'views-change', 'state-change' ] |
77 | 80 | ||
78 | for (const type of types) { | 81 | for (const type of types) { |
79 | this.liveVideosSocket.on(type, (payload: LiveVideoEventPayload) => this.dispatchLiveVideoEvent(type, payload)) | 82 | this.liveVideosSocket.on(type, (payload: LiveVideoEventPayload) => { |
83 | this.ngZone.run(() => this.dispatchLiveVideoEvent(type, payload)) | ||
84 | }) | ||
80 | } | 85 | } |
81 | } | 86 | } |
82 | 87 | ||