trait WebSocketDirectives extends AnyRef
- Grouped
- Alphabetic
- By Inheritance
- WebSocketDirectives
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
WebSocket directives
- 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.
- def extractWebSocketUpgrade: Directive1[WebSocketUpgrade]
Extract the WebSocketUpgrade attribute if this is a WebSocket request.
Extract the WebSocketUpgrade attribute if this is a WebSocket request. Rejects with an ExpectedWebSocketRequestRejection, otherwise.
- def handleWebSocketMessages(handler: Flow[Message, Message, Any]): Route
Handles WebSocket requests with the given handler and rejects other requests with an ExpectedWebSocketRequestRejection.
- 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 thesubprotocol
parameter isSome(protocol)
a WebSocket request is only accepted if the list of subprotocols supported by the client (as announced in the WebSocket request) containsprotocol
. 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. - 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.
- def extractUpgradeToWebSocket: Directive1[UpgradeToWebSocket]
Extract the UpgradeToWebSocket header if existent.
Extract the UpgradeToWebSocket header if existent. Rejects with an ExpectedWebSocketRequestRejection, otherwise.
- Annotations
- @deprecated
- Deprecated
(Since version 10.2.0) use
extractWebSocketUpgrade
instead