diff --git a/server/http4s-server/src/main/scala/sttp/tapir/server/http4s/Http4sWebSockets.scala b/server/http4s-server/src/main/scala/sttp/tapir/server/http4s/Http4sWebSockets.scala index 28886769bb..baf57a36c6 100644 --- a/server/http4s-server/src/main/scala/sttp/tapir/server/http4s/Http4sWebSockets.scala +++ b/server/http4s-server/src/main/scala/sttp/tapir/server/http4s/Http4sWebSockets.scala @@ -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 }