# AuthedRoutes with Websocket

**URL:** https://softwaremill.community/t/authedroutes-with-websocket/514
**Category:** tapir
**Created:** [July 24, 2025, 4:53pm UTC](https://softwaremill.community/t/authedroutes-with-websocket/514 "2025-07-24T16:53:32Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![channingwalton](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/channingwalton/32/331_2.png) [@channingwalton](https://softwaremill.community/u/channingwalton)
#### Post date: [July 24, 2025, 4:53pm UTC](https://softwaremill.community/t/authedroutes-with-websocket/514/1 "2025-07-24T16:53:32Z")

</div>

Hi,

I am building an Authed websocket route, so have:

```auto
val endpoint: Endpoint[Unit, User, ErrorResponse, Pipe[IO, In, Out], capabilities.WebSockets with Context[User] with Fs2Streams[IO]
  ] = …

def thePipe(user: User): fs2.Pipe[IO, In, Out] = …

val serverEndpoints: Full[Unit, Unit, User, ErrorResponse, Pipe[IO, In, Out], WebSockets with Context[User] with Fs2Streams[IO], IO] = 
  endpoint.serverLogicSuccess(user => IO.pure(thePipe(user)))

// Fails to compile 
Http4sServerInterpreter[IO].toContextRoutes(serverEndpoints)

```

How should the serverEndpoints be interpreted?

(I notice that both ` Http4sServerInterpreter.toContextRoutes` call the private `toContextRoutes` with `None` for the `webSocketBuilder`.)

Compilation error:

```auto
overloaded method toContextRoutes with alternatives:
  [T](ses: List[ServerEndpoint[sttp.capabilities.fs2.Fs2Streams[IO] with Context[T],IO]])(implicit evidence$2: scala.reflect.ClassTag[T]): org.ContextRoutes[T,IO] <and>
  [T](se: ServerEndpoint[sttp.capabilities.fs2.Fs2Streams[IO] with Context[T],IO])(implicit evidence$1: scala.reflect.ClassTag[T]): org.ContextRoutes[T,IO]
 cannot be applied to (ServerEndpoint.Full[Unit,Unit,User,ErrorResponse,fs2.Pipe[IO,In,Out,sttp.capabilities.WebSockets with Context[User] with sttp.capabilities.fs2.Fs2Streams[IO],IO])
    Http4sServerInterpreter[IO]().toContextRoutes(serverEndpoints)

```

---

<div class="post-metadata">

### Author: ![adamw](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/adamw/32/28_2.png) [@adamw](https://softwaremill.community/u/adamw)
#### Post date: [July 25, 2025, 8:51am UTC](https://softwaremill.community/t/authedroutes-with-websocket/514/2 "2025-07-25T08:51:02Z")

</div>

Indeed, this method was missing: [Add missing toContextWebSocketRoutes method by adamw · Pull Request #4728 · softwaremill/tapir · GitHub](https://github.com/softwaremill/tapir/pull/4728)
