Interface WebSocketDirectives
-
- All Known Subinterfaces:
Directives
- All Known Implementing Classes:
Directives$
,HttpApp
public interface WebSocketDirectives
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method 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 {@link Sec-WebSocket-Protocol} header if this is a WebSocket request.Directive<scala.Tuple1<UpgradeToWebSocket>>
extractUpgradeToWebSocket()
Deprecated.use `extractWebSocketUpgrade` instead.Directive<scala.Tuple1<WebSocketUpgrade>>
extractWebSocketUpgrade()
Extract the WebSocketUpgrade attribute if this is a WebSocket request.scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>
handleWebSocketMessages(akka.stream.scaladsl.Flow<Message,Message,java.lang.Object> handler)
Handles WebSocket requests with the given handler and rejects other requests with anExpectedWebSocketRequestRejection
.scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>
handleWebSocketMessagesForOptionalProtocol(akka.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 anExpectedWebSocketRequestRejection
.scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>
handleWebSocketMessagesForProtocol(akka.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 anExpectedWebSocketRequestRejection
or anUnsupportedWebSocketSubprotocolRejection
.
-
-
-
Method Detail
-
extractOfferedWsProtocols
Directive<scala.Tuple1<scala.collection.immutable.Seq<java.lang.String>>> extractOfferedWsProtocols()
Extract the list of WebSocket subprotocols as offered by the client in the {@link Sec-WebSocket-Protocol} header if this is a WebSocket request. Rejects with anExpectedWebSocketRequestRejection
, otherwise.- Returns:
- (undocumented)
-
extractUpgradeToWebSocket
Directive<scala.Tuple1<UpgradeToWebSocket>> extractUpgradeToWebSocket()
Deprecated.use `extractWebSocketUpgrade` instead. Since 10.2.0.Extract theUpgradeToWebSocket
header if existent. Rejects with anExpectedWebSocketRequestRejection
, otherwise.- Returns:
- (undocumented)
-
extractWebSocketUpgrade
Directive<scala.Tuple1<WebSocketUpgrade>> extractWebSocketUpgrade()
Extract the WebSocketUpgrade attribute if this is a WebSocket request. Rejects with anExpectedWebSocketRequestRejection
, otherwise.- Returns:
- (undocumented)
-
handleWebSocketMessages
scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> handleWebSocketMessages(akka.stream.scaladsl.Flow<Message,Message,java.lang.Object> handler)
Handles WebSocket requests with the given handler and rejects other requests with anExpectedWebSocketRequestRejection
.- Parameters:
handler
- (undocumented)- Returns:
- (undocumented)
-
handleWebSocketMessagesForOptionalProtocol
scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> handleWebSocketMessagesForOptionalProtocol(akka.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 anExpectedWebSocketRequestRejection
.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 anUnsupportedWebSocketSubprotocolRejection
rejection.To support several subprotocols you may chain several
handleWebSocketMessagesForOptionalProtocol
routes.- Parameters:
handler
- (undocumented)subprotocol
- (undocumented)- Returns:
- (undocumented)
-
handleWebSocketMessagesForProtocol
scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> handleWebSocketMessagesForProtocol(akka.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 anExpectedWebSocketRequestRejection
or anUnsupportedWebSocketSubprotocolRejection
.- Parameters:
handler
- (undocumented)subprotocol
- (undocumented)- Returns:
- (undocumented)
-
-