File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
ws/src/main/scala/sttp/ws Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,13 @@ trait WebSocket[F[_]] {
51
51
case close : WebSocketFrame .Close => monad.error(WebSocketClosed (Some (close)))
52
52
case d : WebSocketFrame .Data [_] => monad.unit(d)
53
53
case WebSocketFrame .Ping (payload) if pongOnPing =>
54
- send(WebSocketFrame .Pong (payload)).flatMap(_ => receiveDataFrame(pongOnPing))
54
+ send(WebSocketFrame .Pong (payload))
55
+ // https://github.com/softwaremill/sttp/issues/2236: after a Ping frame is received, the WS might have become
56
+ // closed. This would cause this call to fail with an exception, while the WS was properly used. That's why
57
+ // we ignore the exception here, and allow for closure (or actual I/O exception) to be discovered via the
58
+ // subsequent `receive`.
59
+ .handleError { case _ => monad.unit(()) }
60
+ .flatMap(_ => receiveDataFrame(pongOnPing))
55
61
case _ => receiveDataFrame(pongOnPing)
56
62
}
57
63
You can’t perform that action at this time.
0 commit comments