aspnetcore-angular-universal icon indicating copy to clipboard operation
aspnetcore-angular-universal copied to clipboard

SSR: How to get periodic updates from server?

Open curlyfro opened this issue 6 years ago • 1 comments

angular 6, asp.net core 2.1, serverside rendering

my app needs to call my api periodically to get user notification updates.

i tried wrapping my rxjs interval call inside my AppComponent

ngOnInit() { if (isPlatformBrowser(this.platformId)) { const subscribe = interval(5000).pipe( takeUntil(this.destroy$) ).subscribe(val => // do stuff ); } }

but the result of this are all my href links do a full browser reload. what's the best practice for doing this?

curlyfro avatar Jun 06 '18 16:06 curlyfro

Not sure why this is needed but since SignalR is fully supported in Dotnet Core 2.1 a cleaner approach would probably be using SignalR. Otherwise, without knowing more it would be hard to describe how to fix your issue. If you can put an example on https://stackblitz.com/ .

GRIMMR3AP3R avatar Jun 06 '18 22:06 GRIMMR3AP3R