RemoteEndpoint.Async (Apache Tomcat 7.0.103 API Documentation)

javax.websocket

## Interface RemoteEndpoint.Async

- All Superinterfaces:
    RemoteEndpoint
  All Known Implementing Classes:
    WsRemoteEndpointAsync
  Enclosing interface:
    RemoteEndpoint

      public static interface RemoteEndpoint.Async
      extends RemoteEndpoint

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface javax.websocket.RemoteEndpoint

      `RemoteEndpoint.Async, RemoteEndpoint.Basic`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getSendTimeout()` Obtain the timeout (in milliseconds) for sending a message asynchronously.
    `Future<Void>` | `sendBinary(ByteBuffer data)` Send the message asynchronously, using the Future to signal to the client when the message has been sent.
    `void` | `sendBinary(ByteBuffer data, SendHandler completion)` Send the message asynchronously, using the SendHandler to signal to the client when the message has been sent.
    `Future<Void>` | `sendObject(Object obj)` Encodes object as a message and sends it asynchronously, using the Future to signal to the client when the message has been sent.
    `void` | `sendObject(Object obj, SendHandler completion)` Encodes object as a message and sends it asynchronously, using the SendHandler to signal to the client when the message has been sent.
    `Future<Void>` | `sendText(String text)` Send the message asynchronously, using the Future to signal to the client when the message has been sent.
    `void` | `sendText(String text, SendHandler completion)` Send the message asynchronously, using the SendHandler to signal to the client when the message has been sent.
    `void` | `setSendTimeout(long timeout)` Set the timeout (in milliseconds) for sending a message asynchronously.

    - ### Methods inherited from interface javax.websocket.RemoteEndpoint

      `flushBatch, getBatchingAllowed, sendPing, sendPong, setBatchingAllowed`

- - ### Method Detail

    - #### getSendTimeout

          long getSendTimeout()

      Obtain the timeout (in milliseconds) for sending a message asynchronously. The default value is determined by `WebSocketContainer.getDefaultAsyncSendTimeout()`.
      Returns:
        The current send timeout in milliseconds. A non-positive value means an infinite timeout.

    - #### setSendTimeout

          void setSendTimeout(long timeout)

      Set the timeout (in milliseconds) for sending a message asynchronously. The default value is determined by `WebSocketContainer.getDefaultAsyncSendTimeout()`.
      Parameters:
        `timeout` - The new timeout for sending messages asynchronously in milliseconds. A non-positive value means an infinite timeout.

    - #### sendText

          void sendText(String text,
                      SendHandler completion)

      Send the message asynchronously, using the SendHandler to signal to the client when the message has been sent.
      Parameters:
        `text` - The text message to send
        `completion` - Used to signal to the client when the message has been sent

    - #### sendText

          Future<Void> sendText(String text)

      Send the message asynchronously, using the Future to signal to the client when the message has been sent.
      Parameters:
        `text` - The text message to send
      Returns:
        A Future that signals when the message has been sent.

    - #### sendBinary

          Future<Void> sendBinary(ByteBuffer data)

      Send the message asynchronously, using the Future to signal to the client when the message has been sent.
      Parameters:
        `data` - The text message to send
      Returns:
        A Future that signals when the message has been sent.
      Throws:
        `IllegalArgumentException` - if `data` is `null`.

    - #### sendBinary

          void sendBinary(ByteBuffer data,
                        SendHandler completion)

      Send the message asynchronously, using the SendHandler to signal to the client when the message has been sent.
      Parameters:
        `data` - The text message to send
        `completion` - Used to signal to the client when the message has been sent
      Throws:
        `IllegalArgumentException` - if `data` or `completion` is `null`.

    - #### sendObject

          Future<Void> sendObject(Object obj)

      Encodes object as a message and sends it asynchronously, using the Future to signal to the client when the message has been sent.
      Parameters:
        `obj` - The object to be sent.
      Returns:
        A Future that signals when the message has been sent.
      Throws:
        `IllegalArgumentException` - if `obj` is `null`.

    - #### sendObject

          void sendObject(Object obj,
                        SendHandler completion)

      Encodes object as a message and sends it asynchronously, using the SendHandler to signal to the client when the message has been sent.
      Parameters:
        `obj` - The object to be sent.
        `completion` - Used to signal to the client when the message has been sent
      Throws:
        `IllegalArgumentException` - if `obj` or `completion` is `null`.

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.