Package play.mvc

Class 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

    public static class WebSocket.MappedWebSocketAcceptor<In,​Out>
    extends Object
    Utility class for creating WebSockets.
    • Method Detail

      • 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

        public WebSocket accept​(Function<Http.RequestHeader,​Flow<In,​Out,​?>> f)
        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.