- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
const connectToServerEpic = (
action$,
) => (
action$
.pipe(
ofType(CONNECT_TO_SERVER),
switchMap(({
hostname,
port,
protocol,
protocolVersion,
reconnectionTimeout,
}) => (
action$
.pipe(
ofType(RECONNECT_TO_SERVER),
takeUntil(
action$
.pipe(
ofType(DISCONNECT_FROM_SERVER),
)
),
startWith(null),
map(() => (
webSocket({
protocol: protocolVersion,
url: (
protocol
.concat('://')
.concat(hostname)
.concat(':')
.concat(port)
),
WebSocketCtor: WebSocket,
})
)),
switchMap((
webSocketConnection$,
) => (
webSocketConnection$
.pipe(
takeUntil(
action$
.pipe(
ofType(
RECONNECT_TO_SERVER,
DISCONNECT_FROM_SERVER,
),
)
),
catchError(() => (
timer(
reconnectionTimeout,
)
.pipe(
takeUntil(
action$
.pipe(
ofType(
RECONNECT_TO_SERVER,
DISCONNECT_FROM_SERVER,
),
)
),
mapTo(reconnectToServer()),
)
)),
map(receivedWebSocketMessage),
startWith(
connectionReady(
webSocketConnection$,
)
),
)),
)),
)
)),
)
)
https://itnext.io/simplifying-websockets-in-rxjs-a177b887f3b8
DypHuu_niBEHb 21.04.2021 21:18 # −2
nuTepcKuu_nemyx 21.04.2021 21:32 # −2
nuTepcKuu_nemyx 21.04.2021 21:33 # −2
DypHuu_niBEHb 21.04.2021 22:35 # −2
guest6 21.04.2021 22:37 # −2
DypHuu_niBEHb 02.10.2022 03:08 # −2
nyTuH_nugop 02.10.2022 04:01 # −2
bootcamp_dropout 21.04.2021 22:03 # −2
booratihno 22.04.2021 05:59 # −1
PolinaAksenova 22.04.2021 06:00 # −2
PolinaAksenova 22.04.2021 07:41 # −2
"Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp."
JloJle4Ka 22.04.2021 08:05 # −2
bormand 22.04.2021 09:04 # −2
j123123 22.04.2021 10:23 # −2
gologub 22.04.2021 23:14 # −2
bootcamp_dropout 22.04.2021 18:49 # −2
j123123 22.04.2021 20:07 # −2
bootcamp_dropout 22.04.2021 22:34 # −2
какой максимализм )))
PolinaAksenova 22.04.2021 05:10 # 0
JloJle4Ka 22.04.2021 05:16 # −2
PolinaAksenova 22.04.2021 05:23 # −2
JloJle4Ka 22.04.2021 05:31 # −2
TOPT 22.04.2021 05:19 # −2
TOPT 23.04.2021 08:58 # −2
bootcamp_dropout 23.04.2021 10:05 # −2
guest6 23.04.2021 11:03 # −2
CHayT 22.04.2021 10:27 # −2
DypHuu_niBEHb 22.04.2021 15:39 # −2
guest6 22.04.2021 15:49 # −2
DypHuu_niBEHb 22.04.2021 16:02 # −2
CHayT 22.04.2021 16:17 # −1
DypHuu_niBEHb 22.04.2021 16:26 # −2
bormand 22.04.2021 16:28 # −1
gologub 22.04.2021 16:42 # −2
у майкроджанка симлинки опять сползли
guest6 23.04.2021 01:26 # −3
bormand 23.04.2021 08:32 # −2
guest6 23.04.2021 11:02 # −1
rotoeb 28.04.2021 02:45 # −1
Jlou_6JlblKAHAX 02.10.2022 11:21 # +3