spice.http.server.handler.WebSocketHandler.scala Maven / Gradle / Ivy
package spice.http.server.handler
import cats.effect.IO
import scribe.mdc.MDC
import spice.http.{HttpExchange, WebSocketListener}
trait WebSocketHandler extends HttpHandler {
def connect(exchange: HttpExchange, listener: WebSocketListener): IO[Unit]
override def handle(exchange: HttpExchange)
(implicit mdc: MDC): IO[HttpExchange] = exchange.withWebSocketListener().flatMap {
case (exchange, listener) => connect(exchange, listener).map(_ => exchange)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy