-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
Hi 😄
Is there already any kind of support for WebSocket based actions?
I had made something like this to make it work here.
trait OAuth2AsyncProvider2 extends OAuth2AsyncProvider {
def authorized[A, U](dataHandler: DataHandler[U])(implicit request: RequestHeader): Future[Either[OAuthError, AuthInfo[U]]] =
ProtectedResource.handleRequest(request, dataHandler)
}Controller:
def liveMatch = WebSocket.async[JsValue] {
implicit request =>
authorized(MyDataHandler).flatMap {
_ match {
case Right(authInfo) => GameStream join authInfo.user
case Left(error) =>
// Just consume and ignore the input
val in = Iteratee.foreach[JsValue](_ => {})
// Send the error message and close
val out = Enumerator[JsValue](
JsObject(Seq("error" -> JsString(error.description)))
).andThen(Enumerator.enumInput(Input.EOF))
Future.successful((in, out))
}
}
}If there isn't, do you plan to support it or we should just use the ProtectedResource class?
ProtectedResource.handleRequest(request, dataHandler)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels