Interface WebSocketUpgrade
- All Superinterfaces:
WebSocketUpgrade
- All Known Implementing Classes:
UpgradeToWebSocketLowLevel
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 TypeMethodDescriptionorg.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message,Message>, org.apache.pekko.NotUsed> createScalaFlow(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource) Java APIJava APIhandleMessages(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, Object> handlerFlow, scala.Function1<Message, Object> shouldCompress) The high-level interface to create a WebSocket server based on "messages".handleMessages(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, Object> handlerFlow, scala.Option<String> subprotocol) The high-level interface to create a WebSocket server based on "messages".handleMessages(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, Object> handlerFlow, scala.Option<String> subprotocol, boolean compressionEnabled) The high-level interface to create a WebSocket server based on "messages".handleMessages(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, Object> handlerFlow, scala.Option<String> subprotocol, scala.Function1<Message, Object> shouldCompress) The high-level interface to create a WebSocket server based on "messages".handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow) Java APIhandleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, boolean compressionEnabled) Java APIhandleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, String subprotocol) Java APIhandleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, String subprotocol, boolean compressionEnabled) Java APIhandleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, String subprotocol, Predicate<Message> shouldCompress) Java APIhandleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, Predicate<Message> shouldCompress) Java APIhandleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource) Java APIhandleMessagesWith(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) Java APIhandleMessagesWith(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) Java APIhandleMessagesWith(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) Java APIhandleMessagesWith(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) Java APIhandleMessagesWith(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) Java APIhandleMessagesWithSinkSource(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, Object> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, Object> outSource, scala.Function1<Message, Object> shouldCompress) The high-level interface to create a WebSocket server based on "messages".handleMessagesWithSinkSource(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, Object> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, Object> outSource, scala.Option<String> subprotocol) The high-level interface to create a WebSocket server based on "messages".handleMessagesWithSinkSource(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, Object> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, Object> outSource, scala.Option<String> subprotocol, boolean compressionEnabled) The high-level interface to create a WebSocket server based on "messages".handleMessagesWithSinkSource(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, Object> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, Object> outSource, scala.Option<String> subprotocol, scala.Function1<Message, Object> shouldCompress) The high-level interface to create a WebSocket server based on "messages".scala.collection.immutable.Seq<String>A sequence of protocols the client accepts.
-
Method Details
-
createScalaFlow
org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message,Message>, createScalaFloworg.apache.pekko.NotUsed> (org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, ?> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, ?> outSource) Java API- Parameters:
inSink- (undocumented)outSource- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-
getRequestedProtocols
Java API- Specified by:
getRequestedProtocolsin interfaceWebSocketUpgrade- Returns:
- (undocumented)
-
handleMessages
HttpResponse handleMessages(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, Object> handlerFlow, scala.Option<String> subprotocol) The high-level interface to create a WebSocket server based on "messages".Returns a response to return in a request handler that will signal the low-level HTTP implementation to upgrade the connection to WebSocket and use the supplied handler to handle incoming WebSocket messages.
Optionally, a subprotocol out of the ones requested by the client can be chosen.
- Parameters:
handlerFlow- (undocumented)subprotocol- (undocumented)- Returns:
- (undocumented)
-
handleMessages
HttpResponse handleMessages(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, Object> handlerFlow, scala.Option<String> subprotocol, boolean compressionEnabled) The high-level interface to create a WebSocket server based on "messages".Returns a response to return in a request handler that will signal the low-level HTTP implementation to upgrade the connection to WebSocket and use the supplied handler to handle incoming WebSocket messages.
Optionally, a subprotocol out of the ones requested by the client can be chosen. The
compressionEnabledflag allows declining negotiated WebSocket compression for this accepted WebSocket.- Parameters:
handlerFlow- (undocumented)subprotocol- (undocumented)compressionEnabled- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-
handleMessages
HttpResponse handleMessages(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, Object> handlerFlow, scala.Function1<Message, Object> shouldCompress) The high-level interface to create a WebSocket server based on "messages".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
-
handleMessages
HttpResponse handleMessages(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, Object> handlerFlow, scala.Option<String> subprotocol, scala.Function1<Message, Object> shouldCompress) The high-level interface to create a WebSocket server based on "messages".Optionally, a subprotocol out of the ones requested by the client can be chosen. 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.FlowShape<Message, Message>, ?> handlerFlow) Java API- Specified by:
handleMessagesWithin interfaceWebSocketUpgrade- Parameters:
handlerFlow- (undocumented)- Returns:
- (undocumented)
-
handleMessagesWith
HttpResponse handleMessagesWith(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<Message, Message>, ?> handlerFlow, boolean compressionEnabled) Java API- Specified by:
handleMessagesWithin interfaceWebSocketUpgrade- 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) Java API- Specified by:
handleMessagesWithin interfaceWebSocketUpgrade- 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) Java API- Specified by:
handleMessagesWithin interfaceWebSocketUpgrade- 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) Java API- Specified by:
handleMessagesWithin interfaceWebSocketUpgrade- 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) Java API- Specified by:
handleMessagesWithin interfaceWebSocketUpgrade- 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) Java API- Specified by:
handleMessagesWithin interfaceWebSocketUpgrade- 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) Java API- Specified by:
handleMessagesWithin interfaceWebSocketUpgrade- 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) Java API- Specified by:
handleMessagesWithin interfaceWebSocketUpgrade- 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) Java API- Specified by:
handleMessagesWithin interfaceWebSocketUpgrade- Parameters:
inSink- (undocumented)outSource- (undocumented)subprotocol- (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, boolean compressionEnabled) Java API- Specified by:
handleMessagesWithin interfaceWebSocketUpgrade- 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) Java API- Specified by:
handleMessagesWithin interfaceWebSocketUpgrade- Parameters:
inSink- (undocumented)outSource- (undocumented)subprotocol- (undocumented)shouldCompress- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-
handleMessagesWithSinkSource
HttpResponse handleMessagesWithSinkSource(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, Object> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, Object> outSource, scala.Option<String> subprotocol) The high-level interface to create a WebSocket server based on "messages".Returns a response to return in a request handler that will signal the low-level HTTP implementation to upgrade the connection to WebSocket and use the supplied inSink to consume messages received from the client and the supplied outSource to produce message to sent to the client.
Optionally, a subprotocol out of the ones requested by the client can be chosen.
- Parameters:
inSink- (undocumented)outSource- (undocumented)subprotocol- (undocumented)- Returns:
- (undocumented)
-
handleMessagesWithSinkSource
HttpResponse handleMessagesWithSinkSource(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, Object> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, Object> outSource, scala.Option<String> subprotocol, boolean compressionEnabled) The high-level interface to create a WebSocket server based on "messages".Returns a response to return in a request handler that will signal the low-level HTTP implementation to upgrade the connection to WebSocket and use the supplied inSink to consume messages received from the client and the supplied outSource to produce message to sent to the client.
Optionally, a subprotocol out of the ones requested by the client can be chosen. The
compressionEnabledflag allows declining negotiated WebSocket compression for this accepted WebSocket.- Parameters:
inSink- (undocumented)outSource- (undocumented)subprotocol- (undocumented)compressionEnabled- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-
handleMessagesWithSinkSource
HttpResponse handleMessagesWithSinkSource(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, Object> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, Object> outSource, scala.Function1<Message, Object> shouldCompress) The high-level interface to create a WebSocket server based on "messages".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
-
handleMessagesWithSinkSource
HttpResponse handleMessagesWithSinkSource(org.apache.pekko.stream.Graph<org.apache.pekko.stream.SinkShape<Message>, Object> inSink, org.apache.pekko.stream.Graph<org.apache.pekko.stream.SourceShape<Message>, Object> outSource, scala.Option<String> subprotocol, scala.Function1<Message, Object> shouldCompress) The high-level interface to create a WebSocket server based on "messages".Optionally, a subprotocol out of the ones requested by the client can be chosen. 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
-
requestedProtocols
scala.collection.immutable.Seq<String> requestedProtocols()A sequence of protocols the client accepts.See http://tools.ietf.org/html/rfc6455#section-1.9
- Returns:
- (undocumented)
-