https://kotlinlang.org logo
Title
f

Fabio

01/31/2022, 1:29 AM
Did you guys run into any considerations for dropped connection and recovering from errors when doing sus over websockets? Specially but not limited to handover from mobile to wifi ?
m

mbonnin

01/31/2022, 7:41 AM
You can either call
retry{}
on each subscrition
Flow
. Or if you want to do things globally, there's a
reconnectWhen
option that will ignore errors and retry silently
f

Fabio

01/31/2022, 11:27 PM
any insights into how to cause such disruptions while writing tests for SSE? if there's anything written for websockets it would be nice having a look.
m

mbonnin

02/01/2022, 8:27 AM
Testing Websockets is not easy (see also https://github.com/apollographql/apollo-kotlin/issues/3259)
The repo has some code to simulate early closures from a WebSocket but it's all very hackish and uses a full-fledged server so I wouldn't really recommend that
1