Skip to content

Commit

Permalink
[mod] Client will now re-connect on WebSocket send error
Browse files Browse the repository at this point in the history
Motivation: it's possible for WebSocket to get into bad state (e.g.
by attempting close with invalid code). In this state, it's neither
closed nor capable of successfully sending.

Without this commit, the socket would needlessly remain in an unusable
state until ws-ping failure.
  • Loading branch information
ptaoussanis committed Mar 7, 2023
1 parent 45e1880 commit bfa4c72
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/taoensso/sente.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
:last-close - ?{:udt _ :reason _}, with reason e/o
#{nil :clean :unexpected :requested-disconnect
:requested-reconnect :downgrading-ws-to-ajax
:ws-ping-timeout}
:ws-ping-timeout :ws-error}
:udt-next-reconnect - Approximate udt of next scheduled auto-reconnect attempt
Notable implementation details:
Expand Down Expand Up @@ -1101,7 +1101,7 @@
:requested-disconnect
:requested-reconnect
:downgrading-ws-to-ajax
:ws-ping-timeout}]
:ws-ping-timeout :ws-error}]
reason)

(let [closing? (:open? state)
Expand Down Expand Up @@ -1396,6 +1396,8 @@
(have ?cb-fn))]
(cb-fn* :chsk/error)))

(-chsk-reconnect! chsk :ws-error)

false))))))

(-chsk-connect! [chsk]
Expand Down

0 comments on commit bfa4c72

Please sign in to comment.