Class TextMessage
java.lang.Object
org.apache.pekko.http.javadsl.model.ws.Message
org.apache.pekko.http.javadsl.model.ws.TextMessage
- Direct Known Subclasses:
TextMessage.Streamed,TextMessage.Strict
Represents a WebSocket text message. A text message can either be strict in which case
the complete data is already available or it can be streamed in which case
getStreamedText()
will return a Source streaming the data as it comes in.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TextMessageadapt(TextMessage msg) Returns this BinaryMessage if it is a binary message, throws otherwise.abstract TextMessageasScala()Returns this TextMessage if it is a text message, throws otherwise.static TextMessageCreates a strict text message.static TextMessageCreates a streamed text message.abstract org.apache.pekko.stream.javadsl.Source<String,?> Returns a source of the text message data.abstract StringReturns the strict message text if this message is strict, throws otherwise.booleanisText()Is this message a text message?abstract CompletionStage<TextMessage.Strict>toStrict(long timeoutMillis, org.apache.pekko.stream.Materializer materializer)
-
Constructor Details
-
TextMessage
public TextMessage()
-
-
Method Details
-
create
Creates a strict text message.- Parameters:
text- (undocumented)- Returns:
- (undocumented)
-
create
Creates a streamed text message.- Parameters:
textStream- (undocumented)- Returns:
- (undocumented)
-
adapt
-
getStreamedText
Returns a source of the text message data.- Returns:
- (undocumented)
-
getStrictText
Returns the strict message text if this message is strict, throws otherwise.- Returns:
- (undocumented)
-
isText
public boolean isText()Description copied from class:MessageIs this message a text message? If true,Message.asTextMessage()will return this text message, if false,Message.asBinaryMessage()will return this binary message. -
asTextMessage
Description copied from class:MessageReturns this TextMessage if it is a text message, throws otherwise.- Specified by:
asTextMessagein classMessage- Returns:
- (undocumented)
-
asBinaryMessage
Description copied from class:MessageReturns this BinaryMessage if it is a binary message, throws otherwise.- Specified by:
asBinaryMessagein classMessage- Returns:
- (undocumented)
-
asScala
-
toStrict
public abstract CompletionStage<TextMessage.Strict> toStrict(long timeoutMillis, org.apache.pekko.stream.Materializer materializer)
-