Package akka.http.javadsl.model.ws
Class TextMessage
java.lang.Object
akka.http.javadsl.model.ws.Message
akka.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
-
Method Summary
Modifier and TypeMethodDescriptionstatic TextMessage
adapt
(TextMessage msg) Returns this BinaryMessage if it is a binary message, throws otherwise.abstract TextMessage
asScala()
Returns this TextMessage if it is a text message, throws otherwise.static TextMessage
Creates a streamed text message.static TextMessage
Creates a strict text message.abstract akka.stream.javadsl.Source<String,
?> Returns a source of the text message data.abstract String
Returns the strict message text if this message is strict, throws otherwise.boolean
isText()
Is this message a text message?abstract CompletionStage<TextMessage.Strict>
toStrict
(long timeoutMillis, akka.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:Message
Is 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:Message
Returns this TextMessage if it is a text message, throws otherwise.- Specified by:
asTextMessage
in classMessage
- Returns:
- (undocumented)
-
asBinaryMessage
Description copied from class:Message
Returns this BinaryMessage if it is a binary message, throws otherwise.- Specified by:
asBinaryMessage
in classMessage
- Returns:
- (undocumented)
-
asScala
-
toStrict
public abstract CompletionStage<TextMessage.Strict> toStrict(long timeoutMillis, akka.stream.Materializer materializer)
-