A function that, given an actor to send upstream messages to, returns actor props to create an actor to handle the WebSocket
Transforms WebSocket message flows into message flows of another type.
Transforms WebSocket message flows into message flows of another type.
The transformation may be more than just converting from one message to another, it may also produce messages, such as close messages with an appropriate error code if the message can't be consumed.
(Since version 2.5.0) Use MessageFlowTransformer instead
Defaults frame formatters.
Accepts a WebSocket using the given flow.
Creates an action that will either accept the websocket, using the given flow to handle the in and out stream, or return a result to reject the Websocket.
Create a WebSocket that will pass messages to/from the actor created by the given props.
Create a WebSocket that will pass messages to/from the actor created by the given props.
Given a request and an actor ref to send messages to, the function passed should return the props for an actor to create to handle this WebSocket.
For example:
def webSocket = WebSocket.acceptWithActor[JsValue, JsValue] { req => out => MyWebSocketActor.props(out) }
(Since version 2.5.0) Use accept with a flow that wraps a Sink.actorRef and Source.actorRef, or play.api.libs.Streams.ActorFlow.actorRef
Creates a WebSocket that will adapt the incoming stream and send it back out.
Creates a WebSocket that will adapt the incoming stream and send it back out.
(Since version 2.5.0) Use accept with an Akka streams flow instead
Creates an action that will either reject the websocket with the given result, or will be handled by the given inbound and outbound channels, asynchronously
Creates an action that will either reject the websocket with the given result, or will be handled by the given inbound and outbound channels, asynchronously
(Since version 2.5.0) Use acceptOrResult with an Akka streams flow instead
Create a WebSocket that will pass messages to/from the actor created by the given props asynchronously.
Create a WebSocket that will pass messages to/from the actor created by the given props asynchronously.
Given a request, this method should return a future of either:
- A result to reject the WebSocket with, or - A function that will take the sending actor, and create the props that describe the actor to handle this WebSocket
For example:
def subscribe = WebSocket.tryAcceptWithActor[JsValue, JsValue] { req => val isAuthenticated: Future[Boolean] = authenticate(req) isAuthenticated.map { case false => Left(Forbidden) case true => Right(MyWebSocketActor.props) } }
(Since version 2.5.0) Use acceptOrResult with a flow that wraps a Sink.actorRef and Source.actorRef, or play.api.libs.Streams.ActorFlow.actorRef
Accepts a WebSocket using the given inbound/outbound channels.
Accepts a WebSocket using the given inbound/outbound channels.
(Since version 2.5.0) Use accept with an Akka streams flow instead
Helper utilities to generate WebSocket results.