Interface WebSocketUpgrade

  • All Known Subinterfaces:
    UpgradeToWebSocket, UpgradeToWebSocket, WebSocketUpgrade
    All Known Implementing Classes:
    UpgradeToWebSocketLowLevel

    public interface WebSocketUpgrade
    An attribute that WebSocket requests will contain. Use WebSocketUpgrade.handleMessagesWith to create a WebSocket handshake response and handle the WebSocket message stream with the given handler.

    This is a low-level API. You might want to use handleWebSocketMessages instead as documented at https://doc.akka.io/libraries/akka-http/current/server-side/websocket-support.html#routing-support

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Iterable<java.lang.String> getRequestedProtocols()
      Returns the sequence of protocols the client accepts.
      HttpResponse handleMessagesWith​(akka.stream.Graph<akka.stream.FlowShape<Message,​Message>,​?> handlerFlow)
      Returns a response that can be used to answer a WebSocket handshake request.
      HttpResponse handleMessagesWith​(akka.stream.Graph<akka.stream.FlowShape<Message,​Message>,​?> handlerFlow, java.lang.String subprotocol)
      Returns a response that can be used to answer a WebSocket handshake request.
      HttpResponse handleMessagesWith​(akka.stream.Graph<akka.stream.SinkShape<Message>,​?> inSink, akka.stream.Graph<akka.stream.SourceShape<Message>,​?> outSource)
      Returns a response that can be used to answer a WebSocket handshake request.
      HttpResponse handleMessagesWith​(akka.stream.Graph<akka.stream.SinkShape<Message>,​?> inSink, akka.stream.Graph<akka.stream.SourceShape<Message>,​?> outSource, java.lang.String subprotocol)
      Returns a response that can be used to answer a WebSocket handshake request.
    • Method Detail

      • getRequestedProtocols

        java.lang.Iterable<java.lang.String> getRequestedProtocols()
        Returns the sequence of protocols the client accepts.

        See http://tools.ietf.org/html/rfc6455#section-1.9

        Returns:
        (undocumented)
      • handleMessagesWith

        HttpResponse handleMessagesWith​(akka.stream.Graph<akka.stream.FlowShape<Message,​Message>,​?> handlerFlow)
        Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given handlerFlow to handle WebSocket messages from the client.
        Parameters:
        handlerFlow - (undocumented)
        Returns:
        (undocumented)
      • handleMessagesWith

        HttpResponse handleMessagesWith​(akka.stream.Graph<akka.stream.FlowShape<Message,​Message>,​?> handlerFlow,
                                        java.lang.String subprotocol)
        Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given handlerFlow to handle WebSocket messages from the client. The given subprotocol must be one of the ones offered by the client.
        Parameters:
        handlerFlow - (undocumented)
        subprotocol - (undocumented)
        Returns:
        (undocumented)
      • handleMessagesWith

        HttpResponse handleMessagesWith​(akka.stream.Graph<akka.stream.SinkShape<Message>,​?> inSink,
                                        akka.stream.Graph<akka.stream.SourceShape<Message>,​?> outSource)
        Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given inSink to handle WebSocket messages from the client and the given outSource to send messages to the client.
        Parameters:
        inSink - (undocumented)
        outSource - (undocumented)
        Returns:
        (undocumented)
      • handleMessagesWith

        HttpResponse handleMessagesWith​(akka.stream.Graph<akka.stream.SinkShape<Message>,​?> inSink,
                                        akka.stream.Graph<akka.stream.SourceShape<Message>,​?> outSource,
                                        java.lang.String subprotocol)
        Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given inSink to handle WebSocket messages from the client and the given outSource to send messages to the client.

        The given subprotocol must be one of the ones offered by the client.

        Parameters:
        inSink - (undocumented)
        outSource - (undocumented)
        subprotocol - (undocumented)
        Returns:
        (undocumented)