t

akka.http.scaladsl.server.directives

WebSocketDirectives

trait WebSocketDirectives extends AnyRef

Source
WebSocketDirectives.scala
Linear Supertypes
Known Subclasses
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. WebSocketDirectives
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

WebSocket directives

  1. def extractOfferedWsProtocols: Directive1[Seq[String]]

    Extract the list of WebSocket subprotocols as offered by the client in the Sec-WebSocket-Protocol header if this is a WebSocket request.

    Extract the list of WebSocket subprotocols as offered by the client in the Sec-WebSocket-Protocol header if this is a WebSocket request. Rejects with an ExpectedWebSocketRequestRejection, otherwise.

  2. def extractUpgradeToWebSocket: Directive1[UpgradeToWebSocket]

    Extract the UpgradeToWebSocket header if existent.

    Extract the UpgradeToWebSocket header if existent. Rejects with an ExpectedWebSocketRequestRejection, otherwise.

  3. def handleWebSocketMessages(handler: Flow[Message, Message, Any]): Route

    Handles WebSocket requests with the given handler and rejects other requests with an ExpectedWebSocketRequestRejection.

  4. def handleWebSocketMessagesForOptionalProtocol(handler: Flow[Message, Message, Any], subprotocol: Option[String]): Route

    Handles WebSocket requests with the given handler and rejects other requests with an ExpectedWebSocketRequestRejection.

    Handles WebSocket requests with the given handler and rejects other requests with an ExpectedWebSocketRequestRejection.

    If the subprotocol parameter is None any WebSocket request is accepted. If the subprotocol parameter is Some(protocol) a WebSocket request is only accepted if the list of subprotocols supported by the client (as announced in the WebSocket request) contains protocol. If the client did not offer the protocol in question the request is rejected with an UnsupportedWebSocketSubprotocolRejection rejection.

    To support several subprotocols you may chain several handleWebSocketMessagesForOptionalProtocol routes.

  5. def handleWebSocketMessagesForProtocol(handler: Flow[Message, Message, Any], subprotocol: String): Route

    Handles WebSocket requests with the given handler if the given subprotocol is offered in the request and rejects other requests with an ExpectedWebSocketRequestRejection or an UnsupportedWebSocketSubprotocolRejection.