Top Inners Methods
jakarta.websocket

public Interface RemoteEndpoint

Known Direct Subinterfaces
jakarta.websocket.RemoteEndpoint.Async, jakarta.websocket.RemoteEndpoint.Basic
Known Direct Implementers
org.apache.tomcat.websocket.WsRemoteEndpointBase, org.apache.tomcat.websocket.WsRemoteEndpointImplBase
Imports
java.io.IOException, .OutputStream, .Writer, java.nio.ByteBuffer, java.util.concurrent.Future

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
public static interface

Method Summary

Modifier and TypeMethod and Description
public void
flushBatch()

Flush any currently batched messages to the remote endpoint.

public boolean

Returns:

true if batching is enabled, otherwise false.
getBatchingAllowed
()

Obtains the current batching status of the endpoint.

public void
sendPing(ByteBuffer
The payload for the ping message
applicationData
)

Send a ping message blocking until the message has been sent.

public void
sendPong(ByteBuffer
The payload for the pong message
applicationData
)

Send a pong message blocking until the message has been sent.

public void
setBatchingAllowed(boolean
New setting
batchingAllowed
)

Enable or disable the batching of outgoing messages for this endpoint.

Method Detail

flushBatchback to summary
public void flushBatch() throws IOException

Flush any currently batched messages to the remote endpoint. This method will block until the flush completes.

Exceptions
IOException:
If an I/O error occurs while flushing
getBatchingAllowedback to summary
public boolean getBatchingAllowed()

Obtains the current batching status of the endpoint.

Returns:boolean

true if batching is enabled, otherwise false.

sendPingback to summary
public 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:ByteBuffer

The payload for the ping message

Exceptions
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)
sendPongback to summary
public 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:ByteBuffer

The payload for the pong message

Exceptions
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)
setBatchingAllowedback to summary
public 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:boolean

New setting

Exceptions
IOException:
If changing the value resulted in a call to flushBatch() and that call threw an IOException.
jakarta.websocket back to summary

public Interface RemoteEndpoint.Async

extends RemoteEndpoint
Known Direct Implementers
org.apache.tomcat.websocket.WsRemoteEndpointAsync

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

The current send timeout in milliseconds. A non-positive value means an infinite timeout.
getSendTimeout
()

Obtain the timeout (in milliseconds) for sending a message asynchronously.

public Future<Void>

Returns:

A Future that signals when the message has been sent.
sendBinary
(ByteBuffer
The text message to send
data
)

Send the message asynchronously, using the Future to signal to the client when the message has been sent.

public void
sendBinary(ByteBuffer
The text message to send
data
,
SendHandler
Used to signal to the client when the message has been sent
completion
)

Send the message asynchronously, using the SendHandler to signal to the client when the message has been sent.

public Future<Void>

Returns:

A Future that signals when the message has been sent.
sendObject
(Object
The object to be sent.
obj
)

Encodes object as a message and sends it asynchronously, using the Future to signal to the client when the message has been sent.

public void
sendObject(Object
The object to be sent.
obj
,
SendHandler
Used to signal to the client when the message has been sent
completion
)

Encodes object as a message and sends it asynchronously, using the SendHandler to signal to the client when the message has been sent.

public void
sendText(String
The text message to send
text
,
SendHandler
Used to signal to the client when the message has been sent
completion
)

Send the message asynchronously, using the SendHandler to signal to the client when the message has been sent.

public Future<Void>

Returns:

A Future that signals when the message has been sent.
sendText
(String
The text message to send
text
)

Send the message asynchronously, using the Future to signal to the client when the message has been sent.

public void
setSendTimeout(long
The new timeout for sending messages asynchronously in milliseconds. A non-positive value means an infinite timeout.
timeout
)

Set the timeout (in milliseconds) for sending a message asynchronously.

Inherited from jakarta.websocket.RemoteEndpoint:
flushBatchgetBatchingAllowedsendPingsendPongsetBatchingAllowed

Method Detail

getSendTimeoutback to summary
public long getSendTimeout()

Obtain the timeout (in milliseconds) for sending a message asynchronously. The default value is determined by WebSocketContainer#getDefaultAsyncSendTimeout().

Returns:long

The current send timeout in milliseconds. A non-positive value means an infinite timeout.

sendBinaryback to summary
public 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:ByteBuffer

The text message to send

Returns:Future<Void>

A Future that signals when the message has been sent.

Exceptions
IllegalArgumentException:
if data is null.
sendBinaryback to summary
public 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:ByteBuffer

The text message to send

completion:SendHandler

Used to signal to the client when the message has been sent

Exceptions
IllegalArgumentException:
if data or completion is null.
sendObjectback to summary
public 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:Object

The object to be sent.

Returns:Future<Void>

A Future that signals when the message has been sent.

Exceptions
IllegalArgumentException:
if obj is null.
sendObjectback to summary
public 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:Object

The object to be sent.

completion:SendHandler

Used to signal to the client when the message has been sent

Exceptions
IllegalArgumentException:
if obj or completion is null.
sendTextback to summary
public 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:String

The text message to send

completion:SendHandler

Used to signal to the client when the message has been sent

sendTextback to summary
public 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:String

The text message to send

Returns:Future<Void>

A Future that signals when the message has been sent.

setSendTimeoutback to summary
public void setSendTimeout(long timeout)

Set the timeout (in milliseconds) for sending a message asynchronously. The default value is determined by WebSocketContainer#getDefaultAsyncSendTimeout().

Parameters
timeout:long

The new timeout for sending messages asynchronously in milliseconds. A non-positive value means an infinite timeout.

jakarta.websocket back to summary

public Interface RemoteEndpoint.Basic

extends RemoteEndpoint
Known Direct Implementers
org.apache.tomcat.websocket.WsRemoteEndpointBasic

Method Summary

Modifier and TypeMethod and Description
public OutputStream
public Writer
public void
sendBinary(ByteBuffer
The binary message to send
data
)

Send the message, blocking until the message is sent.

public void
sendBinary(ByteBuffer
The partial message to send
partialByte
,
boolean
true if this is the last part of the message, otherwise false
isLast
)

Sends part of a binary message to the remote endpoint.

public void
sendObject(Object
The object to be sent.
data
)

Encodes object as a message and sends it to the remote endpoint.

public void
sendText(String
The text message to send.
text
)

Send the message, blocking until the message is sent.

public void
sendText(String
The partial message to send
fragment
,
boolean
true if this is the last part of the message, otherwise false
isLast
)

Sends part of a text message to the remote endpoint.

Inherited from jakarta.websocket.RemoteEndpoint:
flushBatchgetBatchingAllowedsendPingsendPongsetBatchingAllowed

Method Detail

getSendStreamback to summary
public OutputStream getSendStream() throws IOException
getSendWriterback to summary
public Writer getSendWriter() throws IOException
sendBinaryback to summary
public void sendBinary(ByteBuffer data) throws IOException

Send the message, blocking until the message is sent.

Parameters
data:ByteBuffer

The binary message to send

Exceptions
IOException:
if an I/O error occurs during the sending of the message.
IllegalArgumentException:
if data is null.
sendBinaryback to summary
public 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:ByteBuffer

The partial message to send

isLast:boolean

true if this is the last part of the message, otherwise false

Exceptions
IOException:
if an I/O error occurs during the sending of the message.
IllegalArgumentException:
if partialByte is null.
sendObjectback to summary
public void sendObject(Object data) throws IOException, EncodeException

Encodes object as a message and sends it to the remote endpoint.

Parameters
data:Object

The object to be sent.

Exceptions
IOException:
if an I/O error occurs during the sending of the message.
EncodeException:
if there was a problem encoding the data object as a websocket message.
IllegalArgumentException:
if data is null.
sendTextback to summary
public void sendText(String text) throws IOException

Send the message, blocking until the message is sent.

Parameters
text:String

The text message to send.

Exceptions
IOException:
if an I/O error occurs during the sending of the message.
IllegalArgumentException:
if text is null.
sendTextback to summary
public 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:String

The partial message to send

isLast:boolean

true if this is the last part of the message, otherwise false

Exceptions
IOException:
if an I/O error occurs during the sending of the message.
IllegalArgumentException:
if fragment is null.