Package jakarta.websocket

# Interface RemoteEndpoint

All Known Subinterfaces:
  `RemoteEndpoint.Async`, `RemoteEndpoint.Basic`

public interface RemoteEndpoint

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `RemoteEndpoint.Async`
  `static interface`
  `RemoteEndpoint.Basic`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `flushBatch()`
  Flush any currently batched messages to the remote endpoint.
  `boolean`
  `getBatchingAllowed()`
  Obtains the current batching status of the endpoint.
  `void`
  `sendPing(ByteBuffer applicationData)`
  Send a ping message blocking until the message has been sent.
  `void`
  `sendPong(ByteBuffer applicationData)`
  Send a pong message blocking until the message has been sent.
  `void`
  `setBatchingAllowed(boolean batchingAllowed)`
  Enable or disable the batching of outgoing messages for this endpoint.

- ## Method Details

  - ### setBatchingAllowed

    void setBatchingAllowed(boolean batchingAllowed) throws IOException
    Enable or disable the batching of outgoing messages for this endpoint. If batching is disabled when it was previously enabled then this method will block until any currently batched messages have been written.
    Parameters:
      `batchingAllowed` - New setting
    Throws:
      `IOException` - If changing the value resulted in a call to `flushBatch()` and that call threw an `IOException`.

  - ### getBatchingAllowed

    boolean getBatchingAllowed()
    Obtains the current batching status of the endpoint.
    Returns:
      `true` if batching is enabled, otherwise `false`.

  - ### flushBatch

    void flushBatch() throws IOException
    Flush any currently batched messages to the remote endpoint. This method will block until the flush completes.
    Throws:
      `IOException` - If an I/O error occurs while flushing

  - ### sendPing

    void sendPing(ByteBuffer applicationData) throws IOException, IllegalArgumentException
    Send a ping message blocking until the message has been sent. Note that if a message is in the process of being sent asynchronously, this method will block until that message and this ping has been sent.
    Parameters:
      `applicationData` - The payload for the ping message
    Throws:
      `IOException` - If an I/O error occurs while sending the ping
      `IllegalArgumentException` - if the applicationData is too large for a control message (max 125 bytes)

  - ### sendPong

    void sendPong(ByteBuffer applicationData) throws IOException, IllegalArgumentException
    Send a pong message blocking until the message has been sent. Note that if a message is in the process of being sent asynchronously, this method will block until that message and this pong has been sent.
    Parameters:
      `applicationData` - The payload for the pong message
    Throws:
      `IOException` - If an I/O error occurs while sending the pong
      `IllegalArgumentException` - if the applicationData is too large for a control message (max 125 bytes)