Class TextMessage

java.lang.Object
akka.http.javadsl.model.ws.Message
akka.http.javadsl.model.ws.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 Details

    • TextMessage

      public TextMessage()
  • Method Details

    • create

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

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

      public static TextMessage adapt(TextMessage msg)
    • getStreamedText

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

      public abstract String 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.
      Specified by:
      isText in class Message
      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)
    • asScala

      public abstract TextMessage asScala()
      Specified by:
      asScala in class Message
    • toStrict

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