Skip to content

Commit

Permalink
add signalR stateful reconnect support (#646)
Browse files Browse the repository at this point in the history
* add signalR stateful reconnect support

- available due to player.api update to .NET 8
  • Loading branch information
sei-aschlackman authored Oct 9, 2024
1 parent cd443cc commit 26586c7
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 50 deletions.
137 changes: 89 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@datorama/akita": "^8.0.1",
"@datorama/akita-ng-router-store": "^8.0.0",
"@mdi/font": "^7.2.96",
"@microsoft/signalr": "^6.0.0",
"@microsoft/signalr": "^8.0.7",
"@popperjs/core": "^2.10.2",
"angular-resizable-element": "^7.0.2",
"babel-polyfill": "^6.26.0",
Expand Down
5 changes: 4 additions & 1 deletion src/app/services/notification/notification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,21 @@ export class NotificationService {
`${this.settingsSvc.settings.NotificationsSettings.url}/view?bearer=${userToken}`
)
.withAutomaticReconnect(new RetryPolicy(120, 0, 5))
.withStatefulReconnect()
.build();
this.teamConnection = new signalR.HubConnectionBuilder()
.withUrl(
`${this.settingsSvc.settings.NotificationsSettings.url}/team?bearer=${userToken}`
)
.withAutomaticReconnect(new RetryPolicy(120, 0, 5))
.withStatefulReconnect()
.build();
this.userConnection = new signalR.HubConnectionBuilder()
.withUrl(
`${this.settingsSvc.settings.NotificationsSettings.url}/user?bearer=${userToken}`
)
.withAutomaticReconnect(new RetryPolicy(120, 0, 5))
.withStatefulReconnect()
.build();

this.viewConnection.on('Reply', (data: NotificationData) => {
Expand Down Expand Up @@ -181,6 +184,7 @@ export class NotificationService {
this.settingsSvc.settings.NotificationsSettings.url
}/view?bearer=${this.authService.getAuthorizationToken()}`
)
.withStatefulReconnect()
.withAutomaticReconnect(new RetryPolicy(120, 0, 5))
.build();

Expand All @@ -201,7 +205,6 @@ export class NotificationService {
this.invokeJoinPresence(viewId);

this.viewConnection.onreconnected(() => {
this.viewConnection.invoke('JoinView', viewId);
this.viewConnection.invoke('JoinPresence', viewId);
});
}
Expand Down

0 comments on commit 26586c7

Please sign in to comment.