Created
March 19, 2020 16:08
-
-
Save vivainio/64414e19cf9bfaa9cd7a98765683ba2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class SignalrService { | |
constructor(private zone: NgZone) { | |
} | |
messages$ = new Subject<any>(); | |
connect() { | |
const conn = $.hubConnection("/myapp/notifications", { | |
useDefaultPath: false | |
}); | |
const hub = conn.createHubProxy("someroutinghub"); | |
hub.on("response", (messageString: string) => { | |
this.zone.run(() => { | |
this.messages$.next(messageString); | |
}); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment