Interface WebSocketDirectives
- All Known Subinterfaces:
- Directives
- All Known Implementing Classes:
- Directives$,- HttpApp
public interface WebSocketDirectives
- 
Method SummaryModifier and TypeMethodDescriptionExtract 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<WebSocketUpgrade>>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, Object> handler) Handles WebSocket requests with the given handler and rejects other requests with anExpectedWebSocketRequestRejection.scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> handleWebSocketMessagesForOptionalProtocol(org.apache.pekko.stream.scaladsl.Flow<Message, Message, Object> handler, scala.Option<String> subprotocol) Handles WebSocket requests with the given handler and rejects other requests with anExpectedWebSocketRequestRejection.scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> handleWebSocketMessagesForProtocol(org.apache.pekko.stream.scaladsl.Flow<Message, Message, Object> handler, String subprotocol) Handles WebSocket requests with the given handler if the given subprotocol is offered in the request and rejects other requests with anExpectedWebSocketRequestRejectionor anUnsupportedWebSocketSubprotocolRejection.
- 
Method Details- 
extractOfferedWsProtocolsExtract 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)
 
- 
extractWebSocketUpgradeDirective<scala.Tuple1<WebSocketUpgrade>> extractWebSocketUpgrade()Extract the WebSocketUpgrade attribute if this is a WebSocket request. Rejects with anExpectedWebSocketRequestRejection, otherwise.- Returns:
- (undocumented)
 
- 
handleWebSocketMessagesscala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> handleWebSocketMessages(org.apache.pekko.stream.scaladsl.Flow<Message, Message, Object> handler) Handles WebSocket requests with the given handler and rejects other requests with anExpectedWebSocketRequestRejection.- Parameters:
- handler- (undocumented)
- Returns:
- (undocumented)
 
- 
handleWebSocketMessagesForOptionalProtocolscala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> handleWebSocketMessagesForOptionalProtocol(org.apache.pekko.stream.scaladsl.Flow<Message, Message, Object> handler, scala.Option<String> subprotocol) Handles WebSocket requests with the given handler and rejects other requests with anExpectedWebSocketRequestRejection.If the subprotocolparameter is None any WebSocket request is accepted. If thesubprotocolparameter 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 anUnsupportedWebSocketSubprotocolRejectionrejection.To support several subprotocols you may chain several handleWebSocketMessagesForOptionalProtocolroutes.- Parameters:
- handler- (undocumented)
- subprotocol- (undocumented)
- Returns:
- (undocumented)
 
- 
handleWebSocketMessagesForProtocolscala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> handleWebSocketMessagesForProtocol(org.apache.pekko.stream.scaladsl.Flow<Message, Message, Object> handler, String subprotocol) Handles WebSocket requests with the given handler if the given subprotocol is offered in the request and rejects other requests with anExpectedWebSocketRequestRejectionor anUnsupportedWebSocketSubprotocolRejection.- Parameters:
- handler- (undocumented)
- subprotocol- (undocumented)
- Returns:
- (undocumented)
 
 
-