Skip to content

Commit

Permalink
Update optionallyAutoPong. (#3350)
Browse files Browse the repository at this point in the history
Follow-up on #3340

Co-authored-by: Kamil Kloch <[email protected]>
  • Loading branch information
kamilkloch and Kamil Kloch authored Nov 30, 2023
1 parent 3cfec95 commit 927c19c
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ private[http4s] object Http4sWebSockets {
doAuto: Boolean
): Stream[F, WebSocketFrame] = {
if (doAuto) {
s.evalMapFilter {
case ping: WebSocketFrame.Ping => pongs.offer(WebSocketFrame.Pong(ping.payload)).as[Option[WebSocketFrame]](None)
case f => f.some.pure[F]
val trueF = true.pure[F]
s.evalFilter {
case ping: WebSocketFrame.Ping => pongs.offer(WebSocketFrame.Pong(ping.payload)).map(_ => false)
case _ => trueF
}
} else s
}
Expand Down

0 comments on commit 927c19c

Please sign in to comment.