Typeclass to handle WebSocket frames format.
A function that, given an actor to send upstream messages to, returns actor props to create an actor to handle the WebSocket
Defaults frame formatters.
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) }
Creates a WebSocket that will adapt the incoming stream and send it back out.
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
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) } }
Accepts a WebSocket using the given inbound/outbound channels.
Helper utilities to generate WebSocket results.