Interface WebSocketUpgrade
- All Known Subinterfaces:
WebSocketUpgrade
- All Known Implementing Classes:
UpgradeToWebSocketLowLevel
WebSocketUpgrade.handleMessagesWith to
create a WebSocket handshake response and handle the WebSocket message stream with the given handler.
This is a low-level API. You might want to use handleWebSocketMessages instead as documented
at https://pekko.apache.org/docs/pekko-http/current/server-side/websocket-support.html#routing-support
-
Method Summary
Modifier and TypeMethodDescriptionReturns the sequence of protocols the client accepts.handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow) Returns a response that can be used to answer a WebSocket handshake request.handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, boolean compressionEnabled) Returns a response that can be used to answer a WebSocket handshake request.handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, String subprotocol) Returns a response that can be used to answer a WebSocket handshake request.handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, String subprotocol, boolean compressionEnabled) Returns a response that can be used to answer a WebSocket handshake request.handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, String subprotocol, Predicate<Message> shouldCompress) Returns a response that can be used to answer a WebSocket handshake request.handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, Predicate<Message> shouldCompress) Returns a response that can be used to answer a WebSocket handshake request.handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource) Returns a response that can be used to answer a WebSocket handshake request.handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource, boolean compressionEnabled) Returns a response that can be used to answer a WebSocket handshake request.handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource, String subprotocol) Returns a response that can be used to answer a WebSocket handshake request.handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource, String subprotocol, boolean compressionEnabled) Returns a response that can be used to answer a WebSocket handshake request.handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource, String subprotocol, Predicate<Message> shouldCompress) Returns a response that can be used to answer a WebSocket handshake request.handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource, Predicate<Message> shouldCompress) Returns a response that can be used to answer a WebSocket handshake request.
-
Method Details
-
getRequestedProtocols
Returns the sequence of protocols the client accepts.See http://tools.ietf.org/html/rfc6455#section-1.9
- Returns:
- (undocumented)
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow) Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given handlerFlow to handle WebSocket messages from the client.- Parameters:
handlerFlow- (undocumented)- Returns:
- (undocumented)
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, boolean compressionEnabled) Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given handlerFlow to handle WebSocket messages from the client.The compressionEnabled flag allows declining negotiated WebSocket compression for this accepted WebSocket.
- Parameters:
handlerFlow- (undocumented)compressionEnabled- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, Predicate<Message> shouldCompress) Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given handlerFlow to handle WebSocket messages from the client.If
permessage-deflateis negotiated,shouldCompressis evaluated synchronously once for each outbound text or binary message. The result applies to every fragment of that message. Returningtruecompresses the message and returningfalsesends it uncompressed. The filter is not invoked for control frames or when compression was not negotiated, and it does not affect inbound messages or whether compression is negotiated.The filter should be fast and non-blocking; if it throws, the WebSocket stream fails. For streamed messages, the complete payload and its final size are not available when the filter is evaluated.
- Parameters:
handlerFlow- (undocumented)shouldCompress- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, String subprotocol) Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given handlerFlow to handle WebSocket messages from the client. The given subprotocol must be one of the ones offered by the client.- Parameters:
handlerFlow- (undocumented)subprotocol- (undocumented)- Returns:
- (undocumented)
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, String subprotocol, boolean compressionEnabled) Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given handlerFlow to handle WebSocket messages from the client. The given subprotocol must be one of the ones offered by the client.The compressionEnabled flag allows declining negotiated WebSocket compression for this accepted WebSocket.
- Parameters:
handlerFlow- (undocumented)subprotocol- (undocumented)compressionEnabled- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, String subprotocol, Predicate<Message> shouldCompress) Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given handlerFlow to handle WebSocket messages from the client. The given subprotocol must be one of the ones offered by the client.If
permessage-deflateis negotiated,shouldCompressis evaluated synchronously once for each outbound text or binary message. The result applies to every fragment of that message. Returningtruecompresses the message and returningfalsesends it uncompressed. The filter is not invoked for control frames or when compression was not negotiated, and it does not affect inbound messages or whether compression is negotiated.The filter should be fast and non-blocking; if it throws, the WebSocket stream fails. For streamed messages, the complete payload and its final size are not available when the filter is evaluated.
- Parameters:
handlerFlow- (undocumented)subprotocol- (undocumented)shouldCompress- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource) Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given inSink to handle WebSocket messages from the client and the given outSource to send messages to the client.- Parameters:
inSink- (undocumented)outSource- (undocumented)- Returns:
- (undocumented)
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource, boolean compressionEnabled) Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given inSink to handle WebSocket messages from the client and the given outSource to send messages to the client.The compressionEnabled flag allows declining negotiated WebSocket compression for this accepted WebSocket.
- Parameters:
inSink- (undocumented)outSource- (undocumented)compressionEnabled- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource, Predicate<Message> shouldCompress) Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given inSink to handle WebSocket messages from the client and the given outSource to send messages to the client.If
permessage-deflateis negotiated,shouldCompressis evaluated synchronously once for each outbound text or binary message. The result applies to every fragment of that message. Returningtruecompresses the message and returningfalsesends it uncompressed. The filter is not invoked for control frames or when compression was not negotiated, and it does not affect inbound messages or whether compression is negotiated.The filter should be fast and non-blocking; if it throws, the WebSocket stream fails. For streamed messages, the complete payload and its final size are not available when the filter is evaluated.
- Parameters:
inSink- (undocumented)outSource- (undocumented)shouldCompress- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource, String subprotocol) Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given inSink to handle WebSocket messages from the client and the given outSource to send messages to the client.The given subprotocol must be one of the ones offered by the client.
- Parameters:
inSink- (undocumented)outSource- (undocumented)subprotocol- (undocumented)- Returns:
- (undocumented)
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource, String subprotocol, boolean compressionEnabled) Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given inSink to handle WebSocket messages from the client and the given outSource to send messages to the client.The given subprotocol must be one of the ones offered by the client. The compressionEnabled flag allows declining negotiated WebSocket compression for this accepted WebSocket.
- Parameters:
inSink- (undocumented)outSource- (undocumented)subprotocol- (undocumented)compressionEnabled- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource, String subprotocol, Predicate<Message> shouldCompress) Returns a response that can be used to answer a WebSocket handshake request. The connection will afterwards use the given inSink to handle WebSocket messages from the client and the given outSource to send messages to the client. The given subprotocol must be one of the ones offered by the client.If
permessage-deflateis negotiated,shouldCompressis evaluated synchronously once for each outbound text or binary message. The result applies to every fragment of that message. Returningtruecompresses the message and returningfalsesends it uncompressed. The filter is not invoked for control frames or when compression was not negotiated, and it does not affect inbound messages or whether compression is negotiated.The filter should be fast and non-blocking; if it throws, the WebSocket stream fails. For streamed messages, the complete payload and its final size are not available when the filter is evaluated.
- Parameters:
inSink- (undocumented)outSource- (undocumented)subprotocol- (undocumented)shouldCompress- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-