Skip to content

Instantly share code, notes, and snippets.

@Sawtaytoes
Last active December 12, 2019 08:49
Show Gist options
  • Save Sawtaytoes/559f04994a09dfe02f9bcdec7ab7f185 to your computer and use it in GitHub Desktop.
Save Sawtaytoes/559f04994a09dfe02f9bcdec7ab7f185 to your computer and use it in GitHub Desktop.
const connectToServerEpic = (
action$,
) => (
action$
.pipe(
ofType(CONNECT_TO_SERVER),
switchMap(({
// ...
}) => (
action$
.pipe(
ofType(RECONNECT_TO_SERVER),
// ...
startWith(null),
map(() => (
// This is where we create `webSocketConnection$`
webSocket({
// ...
})
)),
switchMap((
webSocketConnection$,
) => (
// ...
)),
// ...
)
)),
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment