Package jakarta.websocket
Interface RemoteEndpoint.Async
-
- All Superinterfaces:
RemoteEndpoint
- Enclosing interface:
- RemoteEndpoint
public static interface RemoteEndpoint.Async extends RemoteEndpoint
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jakarta.websocket.RemoteEndpoint
RemoteEndpoint.Async, RemoteEndpoint.Basic
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getSendTimeout()
Obtain the timeout (in milliseconds) for sending a message asynchronously.java.util.concurrent.Future<java.lang.Void>
sendBinary(java.nio.ByteBuffer data)
Send the message asynchronously, using the Future to signal to the client when the message has been sent.void
sendBinary(java.nio.ByteBuffer data, SendHandler completion)
Send the message asynchronously, using the SendHandler to signal to the client when the message has been sent.java.util.concurrent.Future<java.lang.Void>
sendObject(java.lang.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(java.lang.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.java.util.concurrent.Future<java.lang.Void>
sendText(java.lang.String text)
Send the message asynchronously, using the Future to signal to the client when the message has been sent.void
sendText(java.lang.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 jakarta.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 byWebSocketContainer.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 byWebSocketContainer.getDefaultAsyncSendTimeout()
.- Parameters:
timeout
- The new timeout for sending messages asynchronously in milliseconds. A non-positive value means an infinite timeout.
-
sendText
void sendText(java.lang.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 sendcompletion
- Used to signal to the client when the message has been sent
-
sendText
java.util.concurrent.Future<java.lang.Void> sendText(java.lang.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
java.util.concurrent.Future<java.lang.Void> sendBinary(java.nio.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:
java.lang.IllegalArgumentException
- ifdata
isnull
.
-
sendBinary
void sendBinary(java.nio.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 sendcompletion
- Used to signal to the client when the message has been sent- Throws:
java.lang.IllegalArgumentException
- ifdata
orcompletion
isnull
.
-
sendObject
java.util.concurrent.Future<java.lang.Void> sendObject(java.lang.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:
java.lang.IllegalArgumentException
- ifobj
isnull
.
-
sendObject
void sendObject(java.lang.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:
java.lang.IllegalArgumentException
- ifobj
orcompletion
isnull
.
-
-