Last active
July 22, 2019 11:26
-
-
Save praveen001/f13bdce32c1d09bbb1d5a5efa8deadc3 to your computer and use it in GitHub Desktop.
Redux Observable WebSocket
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
const connectEpic = (action$, state$: StateObservable<IState>) => | |
action$ | |
.ofType(WebsocketActionTypes.CONNECT) | |
.switchMap((action: IConnectWebsocketAction) => | |
connectSocket(state$.value.eventConfig.webSocketURL) | |
.map(data => receiveMessageFromWebSocket(data)) // <-- Map and fire receive action | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment