Skip to content

Commit

Permalink
Update optionallyAutoPong.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kloch committed Nov 30, 2023
1 parent 3cfec95 commit bc15631
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 bc15631

Please sign in to comment.