Class TextMessage

  • Direct Known Subclasses:
    TextMessage.Streamed, TextMessage.Strict

    public abstract class TextMessage
    extends Message
    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 Detail

      • TextMessage

        public TextMessage()
    • Method Detail

      • create

        public static TextMessage create​(java.lang.String text)
        Creates a strict text message.
        Parameters:
        text - (undocumented)
        Returns:
        (undocumented)
      • create

        public static TextMessage create​(akka.stream.javadsl.Source<java.lang.String,​?> textStream)
        Creates a streamed text message.
        Parameters:
        textStream - (undocumented)
        Returns:
        (undocumented)
      • getStreamedText

        public abstract akka.stream.javadsl.Source<java.lang.String,​?> getStreamedText()
        Returns a source of the text message data.
        Returns:
        (undocumented)
      • getStrictText

        public abstract java.lang.String getStrictText()
        Returns the strict message text if this message is strict, throws otherwise.
        Returns:
        (undocumented)
      • asTextMessage

        public TextMessage asTextMessage()
        Description copied from class: Message
        Returns this TextMessage if it is a text message, throws otherwise.
        Specified by:
        asTextMessage in class Message
        Returns:
        (undocumented)
      • asBinaryMessage

        public BinaryMessage asBinaryMessage()
        Description copied from class: Message
        Returns this BinaryMessage if it is a binary message, throws otherwise.
        Specified by:
        asBinaryMessage in class Message
        Returns:
        (undocumented)
      • toStrict

        public abstract java.util.concurrent.CompletionStage<TextMessage.Strict> toStrict​(long timeoutMillis,
                                                                                          akka.stream.Materializer materializer)