Package play.mvc
Class WebSocket.MappedWebSocketAcceptor<In,Out>
java.lang.Object
play.mvc.WebSocket.MappedWebSocketAcceptor<In,Out>
- Type Parameters:
In- the type the websocket reads from clients (e.g. String, JsonNode)Out- the type the websocket outputs back to remote clients (e.g. String, JsonNode)
- Enclosing class:
- WebSocket
Utility class for creating WebSockets.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAccept a WebSocket.Accept a WebSocket.
-
Constructor Details
-
MappedWebSocketAcceptor
-
-
Method Details
-
acceptOrResult
public WebSocket acceptOrResult(Function<Http.RequestHeader, CompletionStage<F.Either<Result, Flow<In, Out, ?>>>> f) Accept a WebSocket.- Parameters:
f- A function that takes the request header, and returns a future of either the result to reject the WebSocket connection with, or a flow to handle the WebSocket messages.- Returns:
- The WebSocket handler.
-
accept
Accept a WebSocket.- Parameters:
f- A function that takes the request header, and returns a flow to handle the WebSocket messages.- Returns:
- The WebSocket handler.
-