RemoteEndpoint.Basic (WebSocket 2.1 API Documentation - Apache Tomcat 10.1.48)
Description: declaration: package: jakarta.websocket, interface: RemoteEndpoint, interface: Basic

# Interface RemoteEndpoint.Basic

All Superinterfaces:
  `RemoteEndpoint`

Enclosing interface:
  `RemoteEndpoint`

public static interface RemoteEndpoint.Basic extends RemoteEndpoint

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface RemoteEndpoint

  `RemoteEndpoint.Async, RemoteEndpoint.Basic`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `OutputStream`
  `getSendStream()`
  `Writer`
  `getSendWriter()`
  `void`
  `sendBinary(ByteBuffer data)`
  Send the message, blocking until the message is sent.
  `void`
  `sendBinary(ByteBuffer partialByte, boolean isLast)`
  Sends part of a binary message to the remote endpoint.
  `void`
  `sendObject(Object data)`
  Encodes object as a message and sends it to the remote endpoint.
  `void`
  `sendText(String text)`
  Send the message, blocking until the message is sent.
  `void`
  `sendText(String fragment, boolean isLast)`
  Sends part of a text message to the remote endpoint.

  ### Methods inherited from interface RemoteEndpoint

  `flushBatch, getBatchingAllowed, sendPing, sendPong, setBatchingAllowed`

- ## Method Details

  - ### sendText

    void sendText(String text) throws IOException
    Send the message, blocking until the message is sent.
    Parameters:
      `text` - The text message to send.
    Throws:
      `IllegalArgumentException` - if `text` is `null`.
      `IOException` - if an I/O error occurs during the sending of the message.

  - ### sendBinary

    void sendBinary(ByteBuffer data) throws IOException
    Send the message, blocking until the message is sent.
    Parameters:
      `data` - The binary message to send
    Throws:
      `IllegalArgumentException` - if `data` is `null`.
      `IOException` - if an I/O error occurs during the sending of the message.

  - ### sendText

    void sendText(String fragment, boolean isLast) throws IOException
    Sends part of a text message to the remote endpoint. Once the first part of a message has been sent, no other text or binary messages may be sent until all remaining parts of this message have been sent.
    Parameters:
      `fragment` - The partial message to send
      `isLast` - `true` if this is the last part of the message, otherwise `false`
    Throws:
      `IllegalArgumentException` - if `fragment` is `null`.
      `IOException` - if an I/O error occurs during the sending of the message.

  - ### sendBinary

    void sendBinary(ByteBuffer partialByte, boolean isLast) throws IOException
    Sends part of a binary message to the remote endpoint. Once the first part of a message has been sent, no other text or binary messages may be sent until all remaining parts of this message have been sent.
    Parameters:
      `partialByte` - The partial message to send
      `isLast` - `true` if this is the last part of the message, otherwise `false`
    Throws:
      `IllegalArgumentException` - if `partialByte` is `null`.
      `IOException` - if an I/O error occurs during the sending of the message.

  - ### getSendStream

    OutputStream getSendStream() throws IOException
    Throws:
      `IOException`

  - ### getSendWriter

    Writer getSendWriter() throws IOException
    Throws:
      `IOException`

  - ### sendObject

    void sendObject(Object data) throws IOException, EncodeException
    Encodes object as a message and sends it to the remote endpoint.
    Parameters:
      `data` - The object to be sent.
    Throws:
      `EncodeException` - if there was a problem encoding the `data` object as a websocket message.
      `IllegalArgumentException` - if `data` is `null`.
      `IOException` - if an I/O error occurs during the sending of the message.