Compatibility with


I am wondering if this library would be compatible with the project. It seems like it would work in theory by injecting the silhouette environment into the engine, but I can’t really tell. Does anyone have any experience with this? Here’s a link to the project:

And the relevant authentication section:

I guess the question boils down to I have a raw RequestHeader. How can I use that to manually authenticate with my silhouette environment? Happy to submit a PR to the docs if I can get this working.


It was actually quite easy. I simply followed the example in the WebSocket section of the official documentation and injected the silhouette environment into my engine provider. Here is my code for anyone interested:

class SocketIOEngineProvider @Inject()(socketIO: SocketIO,
                                       silhouette: Silhouette[DefaultEnv])(
    implicit mat: Materializer,
    ec: ExecutionContext)
    extends Provider[EngineIOController]
    with Logger {

  override lazy val get: EngineIOController =
      .onConnectAsync { (request, _) =>
          implicit val req: Request[AnyContentAsEmpty.type] =
            Request(request, AnyContentAsEmpty)
            .SecuredRequestHandler { securedRequest =>
                HandlerResult(Ok, Some(securedRequest.identity)))
            .map {
              case HandlerResult(_, Some(user)) => Right(user)
              case HandlerResult(r, None) => Left(r)

Would be great to have an example on

Hi Akkie,

I just submitting an example to the docs. Please review when you can.



Great, Thanks! I’ve merged it :+1: