Last active
June 5, 2021 07:54
-
-
Save vladimir-ivanov/0f54c742b6d518647797a3ae6120e454 to your computer and use it in GitHub Desktop.
microsoft signalr stream converted to rxjs stream for greater flexibility
This file contains 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
import {HubConnection} from '@microsoft/signalr'; | |
//payload can be a one off payload or a Subject | |
export const getSignalRStreamRx = (hubConnection: HubConnection, operation: string, payload: any) => new Observable(observer => { | |
const subscription = hubConnection.stream(observer, operation, payload); | |
return { | |
unsubscribe: () => { | |
subscription.unsubscribe(); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment