public interface WebSocketDirectives
| Modifier and Type | Method and Description |
|---|---|
Directive<scala.Tuple1<scala.collection.immutable.Seq<java.lang.String>>> |
extractOfferedWsProtocols()
Extract the list of WebSocket subprotocols as offered by the client in the
Sec-WebSocket-Protocol header if
this is a WebSocket request. |
Directive<scala.Tuple1<UpgradeToWebSocket>> |
extractUpgradeToWebSocket()
Deprecated.
use `extractWebSocketUpgrade` instead. Since Akka HTTP 10.2.0.
|
Directive<scala.Tuple1<WebSocketUpgrade>> |
extractWebSocketUpgrade()
Extract the WebSocketUpgrade attribute if this is a WebSocket request.
|
scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> |
handleWebSocketMessages(org.apache.pekko.stream.scaladsl.Flow<Message,Message,java.lang.Object> handler)
Handles WebSocket requests with the given handler and rejects other requests with an
ExpectedWebSocketRequestRejection. |
scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> |
handleWebSocketMessagesForOptionalProtocol(org.apache.pekko.stream.scaladsl.Flow<Message,Message,java.lang.Object> handler,
scala.Option<java.lang.String> subprotocol)
Handles WebSocket requests with the given handler and rejects other requests with an
ExpectedWebSocketRequestRejection. |
scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> |
handleWebSocketMessagesForProtocol(org.apache.pekko.stream.scaladsl.Flow<Message,Message,java.lang.Object> handler,
java.lang.String subprotocol)
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. |
Directive<scala.Tuple1<scala.collection.immutable.Seq<java.lang.String>>> extractOfferedWsProtocols()
Sec-WebSocket-Protocol header if
this is a WebSocket request. Rejects with an ExpectedWebSocketRequestRejection, otherwise.
Directive<scala.Tuple1<UpgradeToWebSocket>> extractUpgradeToWebSocket()
UpgradeToWebSocket header if existent. Rejects with an ExpectedWebSocketRequestRejection, otherwise.
Directive<scala.Tuple1<WebSocketUpgrade>> extractWebSocketUpgrade()
ExpectedWebSocketRequestRejection, otherwise.
scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> handleWebSocketMessages(org.apache.pekko.stream.scaladsl.Flow<Message,Message,java.lang.Object> handler)
ExpectedWebSocketRequestRejection.
handler - (undocumented)scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> handleWebSocketMessagesForOptionalProtocol(org.apache.pekko.stream.scaladsl.Flow<Message,Message,java.lang.Object> handler, scala.Option<java.lang.String> subprotocol)
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.
handler - (undocumented)subprotocol - (undocumented)scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> handleWebSocketMessagesForProtocol(org.apache.pekko.stream.scaladsl.Flow<Message,Message,java.lang.Object> handler, java.lang.String subprotocol)
ExpectedWebSocketRequestRejection or an UnsupportedWebSocketSubprotocolRejection.
handler - (undocumented)subprotocol - (undocumented)