Fix socket io with angular
This commit is contained in:
parent
e43b5a3fa8
commit
dc1f314efd
|
@ -66,12 +66,8 @@
|
||||||
<div class="video-info-first-row-bottom">
|
<div class="video-info-first-row-bottom">
|
||||||
<div class="d-none d-md-block video-info-date-views">
|
<div class="d-none d-md-block video-info-date-views">
|
||||||
<ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container>
|
<ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container>
|
||||||
|
•
|
||||||
<span i18n [title]="video.getExactNumberOfViews()" class="views">
|
<my-video-views-counter [video]="video"></my-video-views-counter>
|
||||||
• {{ video.views | myNumberFormatter }}
|
|
||||||
<ng-container *ngIf="!video.isLive">views</ng-container>
|
|
||||||
<ng-container *ngIf="video.isLive">viewers</ng-container>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="video-actions-rates">
|
<div class="video-actions-rates">
|
||||||
|
|
|
@ -58,9 +58,12 @@ export class PeerTubeSocket {
|
||||||
this.notificationSocket = this.io(environment.apiUrl + '/user-notifications', {
|
this.notificationSocket = this.io(environment.apiUrl + '/user-notifications', {
|
||||||
query: { accessToken: this.auth.getAccessToken() }
|
query: { accessToken: this.auth.getAccessToken() }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.notificationSocket.on('new-notification', (n: UserNotificationServer) => {
|
||||||
|
this.ngZone.run(() => this.dispatchNotificationEvent('new', n))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
this.notificationSocket.on('new-notification', (n: UserNotificationServer) => this.dispatchNotificationEvent('new', n))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async initLiveVideosSocket () {
|
private async initLiveVideosSocket () {
|
||||||
|
@ -76,7 +79,9 @@ export class PeerTubeSocket {
|
||||||
const types: LiveVideoEventType[] = [ 'views-change', 'state-change' ]
|
const types: LiveVideoEventType[] = [ 'views-change', 'state-change' ]
|
||||||
|
|
||||||
for (const type of types) {
|
for (const type of types) {
|
||||||
this.liveVideosSocket.on(type, (payload: LiveVideoEventPayload) => this.dispatchLiveVideoEvent(type, payload))
|
this.liveVideosSocket.on(type, (payload: LiveVideoEventPayload) => {
|
||||||
|
this.ngZone.run(() => this.dispatchLiveVideoEvent(type, payload))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user