Top Description Inners Fields Constructors Methods
org.glassfish.tyrus.core

public abstract Class TyrusRemoteEndpoint

extends Object
implements RemoteEndpoint
Class Inheritance
All Implemented Interfaces
jakarta.websocket.RemoteEndpoint
Known Direct Subclasses
org.glassfish.tyrus.core.TyrusRemoteEndpoint.Basic, org.glassfish.tyrus.core.TyrusRemoteEndpoint.Async
Imports
java.io.ByteArrayOutputStream, .IOException, .OutputStream, .StringWriter, .Writer, java.nio.ByteBuffer, java.util.concurrent.ExecutionException, .Future, .TimeUnit, .TimeoutException, java.util.logging.Level, .Logger, jakarta.websocket.CloseReason, .EncodeException, .SendHandler, .SendResult, org.glassfish.tyrus.core.l10n.LocalizationMessages, org.glassfish.tyrus.spi.WriterInfo, .WriterInfo.MessageType, .WriterInfo.RemoteEndpointType

Wraps the jakarta.websocket.RemoteEndpoint and represents the other side of the websocket connection.
Authors
Danny Coward, Martin Matula, Stepan Kopriva, Pavel Bucek

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final TyrusEndpointWrapper
private static final Logger
pack-priv final TyrusSession
pack-priv final TyrusWebSocket

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
public void
flushBatch()

Implements jakarta.websocket.RemoteEndpoint.flushBatch.

This method is only used when batching is allowed for this RemoteEndpint.

public boolean
getBatchingAllowed()

Implements jakarta.websocket.RemoteEndpoint.getBatchingAllowed.

Return whether the implementation is allowed to batch outgoing messages before sending.

public void
sendPing(ByteBuffer
the data to be carried in the ping request.
applicationData
)

Implements jakarta.websocket.RemoteEndpoint.sendPing.

Send a Ping message containing the given application data to the remote endpoint.

public void
sendPong(ByteBuffer
the application data to be carried in the pong response.
applicationData
)

Implements jakarta.websocket.RemoteEndpoint.sendPong.

Allows the developer to send an unsolicited Pong message containing the given application data in order to serve as a unidirectional heartbeat for the session.

pack-priv Future<?>
pack-priv void
sendSyncObject(Object o, SendHandler handler, WriterInfo writerInfo)

public void
setBatchingAllowed(boolean
whether the implementation is allowed to batch messages.
allowed
)

Implements jakarta.websocket.RemoteEndpoint.setBatchingAllowed.

Indicate to the implementation that it is allowed to batch outgoing messages before sending.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

endpointWrapperback to summary
private final TyrusEndpointWrapper endpointWrapper
LOGGERback to summary
private static final Logger LOGGER
sessionback to summary
pack-priv final TyrusSession session
webSocketback to summary
pack-priv final TyrusWebSocket webSocket

Constructor Detail

TyrusRemoteEndpointback to summary
private TyrusRemoteEndpoint(TyrusSession session, TyrusWebSocket socket, TyrusEndpointWrapper endpointWrapper)

Method Detail

closeback to summary
public void close(CloseReason cr)
flushBatchback to summary
public void flushBatch()

Implements jakarta.websocket.RemoteEndpoint.flushBatch.

Doc from jakarta.websocket.RemoteEndpoint.flushBatch.

This method is only used when batching is allowed for this RemoteEndpint. Calling this method forces the implementation to send any unsent messages it has been batching.

Annotations
@Override
getBatchingAllowedback to summary
public boolean getBatchingAllowed()

Implements jakarta.websocket.RemoteEndpoint.getBatchingAllowed.

Doc from jakarta.websocket.RemoteEndpoint.getBatchingAllowed.

Return whether the implementation is allowed to batch outgoing messages before sending. The default mode for RemoteEndpoints is false. The value may be changed by calling setBatchingAllowed.

Returns:boolean

true if the implementation is allowed to batch outgoing messages before sending, otherwise false

Annotations
@Override
sendPingback to summary
public void sendPing(ByteBuffer applicationData) throws IOException

Implements jakarta.websocket.RemoteEndpoint.sendPing.

Doc from jakarta.websocket.RemoteEndpoint.sendPing.

Send a Ping message containing the given application data to the remote endpoint. The corresponding Pong message may be picked up using the MessageHandler.Pong handler.

It is not safe for other threads to use the ByteBuffer until the sending of this message is complete. If the sending of the message completes successfully, the buffer's limit will be unchanged and the buffer's position will be equal to the limit. If the sending of the message does not complete successfully, the state of the buffer is undefined.

Parameters
applicationData:ByteBuffer

the data to be carried in the ping request.

Annotations
@Override
Exceptions
IOException:
if the ping failed to be sent
sendPongback to summary
public void sendPong(ByteBuffer applicationData) throws IOException

Implements jakarta.websocket.RemoteEndpoint.sendPong.

Doc from jakarta.websocket.RemoteEndpoint.sendPong.

Allows the developer to send an unsolicited Pong message containing the given application data in order to serve as a unidirectional heartbeat for the session.

It is not safe for other threads to use the ByteBuffer until the sending of this message is complete. If the sending of the message completes successfully, the buffer's limit will be unchanged and the buffer's position will be equal to the limit. If the sending of the message does not complete successfully, the state of the buffer is undefined.

Parameters
applicationData:ByteBuffer

the application data to be carried in the pong response.

Annotations
@Override
Exceptions
IOException:
if the pong failed to be sent
sendSyncObjectback to summary
pack-priv Future<?> sendSyncObject(Object o, WriterInfo writerInfo)
Annotations
@SuppressWarnings:unchecked
sendSyncObjectback to summary
pack-priv void sendSyncObject(Object o, SendHandler handler, WriterInfo writerInfo)
Annotations
@SuppressWarnings:unchecked
setBatchingAllowedback to summary
public void setBatchingAllowed(boolean allowed)

Implements jakarta.websocket.RemoteEndpoint.setBatchingAllowed.

Doc from jakarta.websocket.RemoteEndpoint.setBatchingAllowed.

Indicate to the implementation that it is allowed to batch outgoing messages before sending. Not all implementations support batching of outgoing messages. The default mode for RemoteEndpoints is false. If the developer has indicated that batching of outgoing messages is permitted, then the developer must call flushBatch() in order to be sure that all the messages passed into the send methods of this RemoteEndpoint are sent. When batching is allowed, the implementations send operations are considered to have completed if the message has been written to the local batch, in the case when there is still room in the batch for the message, and are considered to have completed if the batch has been send to the peer and the remainder written to the new batch, in the case when writing the message causes the batch to need to be sent. The blocking and asynchronous send methods use this notion of completion in order to complete blocking calls, notify SendHandlers and complete Futures respectively. When batching is allowed, if the developer has called send methods on this RemoteEndpoint without calling flushBatch(), then the implementation may not have sent all the messages the developer has asked to be sent. If the parameter value is false and the implementation has a batch of unsent messages, then the implementation must immediately send the batch of unsent messages.

Parameters
allowed:boolean

whether the implementation is allowed to batch messages.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.glassfish.tyrus.core back to summary

pack-priv Class TyrusRemoteEndpoint.Async

extends TyrusRemoteEndpoint
implements Async
Class Inheritance
All Implemented Interfaces
jakarta.websocket.RemoteEndpoint.Async, jakarta.websocket.RemoteEndpoint

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private long
Inherited from org.glassfish.tyrus.core.TyrusRemoteEndpoint:
sessionwebSocket

Constructor Summary

AccessConstructor and Description
pack-priv
Async(TyrusSession session, TyrusWebSocket socket, TyrusEndpointWrapper endpointWrapper)

Method Summary

Modifier and TypeMethod and Description
public long
getSendTimeout()

Implements jakarta.websocket.RemoteEndpoint.Async.getSendTimeout.

Return the number of milliseconds the implementation will timeout attempting to send a websocket message.

private Future<Void>

Returns:

message sending callback Future
sendAsync
(final Object
message to be sent
message
,
final TyrusRemoteEndpoint.Async.AsyncMessageType
message type
type
)

Sends the message asynchronously.

private void
sendAsync(final Object
message to be sent
message
,
final SendHandler
message sending callback handler
handler
,
final TyrusRemoteEndpoint.Async.AsyncMessageType
message type
type
)

Sends the message asynchronously.

public Future<Void>
sendBinary(ByteBuffer
the data being sent.
data
)

Implements jakarta.websocket.RemoteEndpoint.Async.sendBinary.

Initiates the asynchronous transmission of a binary message.

public void
sendBinary(ByteBuffer
the data being sent, must not be null.
data
,
SendHandler
the handler that will be notified of progress, must not be null.
handler
)

Implements jakarta.websocket.RemoteEndpoint.Async.sendBinary.

Initiates the asynchronous transmission of a binary message.

public void
sendObject(Object
the object being sent.
data
,
SendHandler
the handler that will be notified of progress, must not be null.
handler
)

Implements jakarta.websocket.RemoteEndpoint.Async.sendObject.

Initiates the asynchronous transmission of a custom developer object.

public Future<Void>
sendObject(Object
the object being sent.
data
)

Implements jakarta.websocket.RemoteEndpoint.Async.sendObject.

Initiates the asynchronous transmission of a custom developer object.

public void
sendText(String
the text being sent.
text
,
SendHandler
the handler which will be notified of progress.
handler
)

Implements jakarta.websocket.RemoteEndpoint.Async.sendText.

Initiates the asynchronous transmission of a text message.

public Future<Void>
sendText(String
the text being sent.
text
)

Implements jakarta.websocket.RemoteEndpoint.Async.sendText.

Initiates the asynchronous transmission of a text message.

public void
setSendTimeout(long
The number of milliseconds this RemoteEndpoint will wait before timing out an incomplete asynchronous message send.
timeoutmillis
)

Implements jakarta.websocket.RemoteEndpoint.Async.setSendTimeout.

Sets the number of milliseconds the implementation will timeout attempting to send a websocket message.

Inherited from org.glassfish.tyrus.core.TyrusRemoteEndpoint:
closeflushBatchgetBatchingAllowedsendPingsendPongsendSyncObjectsendSyncObjectsetBatchingAllowedtoString

Field Detail

sendTimeoutback to summary
private long sendTimeout

Constructor Detail

Asyncback to summary
pack-priv Async(TyrusSession session, TyrusWebSocket socket, TyrusEndpointWrapper endpointWrapper)

Method Detail

getSendTimeoutback to summary
public long getSendTimeout()

Implements jakarta.websocket.RemoteEndpoint.Async.getSendTimeout.

Doc from jakarta.websocket.RemoteEndpoint.Async.getSendTimeout.

Return the number of milliseconds the implementation will timeout attempting to send a websocket message. A zero or negative value indicates the implementation will not timeout attempting to send a websocket message asynchronously. This value overrides the default value assigned in the WebSocketContainer.

Returns:long

the timeout time in milliseconds.

Annotations
@Override
sendAsyncback to summary
private Future<Void> sendAsync(final Object message, final TyrusRemoteEndpoint.Async.AsyncMessageType type)

Sends the message asynchronously.

Important Note

There is no need to start new thread here. All writer operations are by default asynchronous, the only difference between sync and async writer are that sync send should wait for future.get().

Parameters
message:Object

message to be sent

type:TyrusRemoteEndpoint.Async.AsyncMessageType

message type

Returns:Future<Void>

message sending callback Future

sendAsyncback to summary
private void sendAsync(final Object message, final SendHandler handler, final TyrusRemoteEndpoint.Async.AsyncMessageType type)

Sends the message asynchronously.

Important Note

There is no need to start new thread here. All writer are by default asynchronous, only difference between sync and async writer are that sync send should wait for future.get().

Parameters
message:Object

message to be sent

handler:SendHandler

message sending callback handler

type:TyrusRemoteEndpoint.Async.AsyncMessageType

message type

sendBinaryback to summary
public Future<Void> sendBinary(ByteBuffer data)

Implements jakarta.websocket.RemoteEndpoint.Async.sendBinary.

Doc from jakarta.websocket.RemoteEndpoint.Async.sendBinary.

Initiates the asynchronous transmission of a binary message. This method returns before the message is transmitted. Developers use the returned Future object to track progress of the transmission. The Future's get() method returns null upon successful completion. Errors in transmission are wrapped in the java.util.concurrent.ExecutionException thrown when querying the Future object.

It is not safe for other threads to use the ByteBuffer until the sending of this message is complete. If the sending of the message completes successfully, the buffer's limit will be unchanged and the buffer's position will be equal to the limit. If the sending of the message does not complete successfully, the state of the buffer is undefined.

Parameters
data:ByteBuffer

the data being sent.

Returns:Future<Void>

the Future object representing the send operation.

Annotations
@Override
sendBinaryback to summary
public void sendBinary(ByteBuffer data, SendHandler handler)

Implements jakarta.websocket.RemoteEndpoint.Async.sendBinary.

Doc from jakarta.websocket.RemoteEndpoint.Async.sendBinary.

Initiates the asynchronous transmission of a binary message. This method returns before the message is transmitted. Developers provide a callback to be notified when the message has been transmitted. Errors in transmission are given to the developer in the SendResult object.

It is not safe for other threads to use the ByteBuffer until the sending of this message is complete. If the sending of the message completes successfully, the buffer's limit will be unchanged and the buffer's position will be equal to the limit. If the sending of the message does not complete successfully, the state of the buffer is undefined.

Parameters
data:ByteBuffer

the data being sent, must not be null.

handler:SendHandler

the handler that will be notified of progress, must not be null.

Annotations
@Override
sendObjectback to summary
public void sendObject(Object data, SendHandler handler)

Implements jakarta.websocket.RemoteEndpoint.Async.sendObject.

Doc from jakarta.websocket.RemoteEndpoint.Async.sendObject.

Initiates the asynchronous transmission of a custom developer object. Containers will by default be able to encode java primitive types and their object equivalents, otherwise the developer must have provided an encoder for the object type in the endpoint configuration. A developer-provided encoder for a Java primitive type and its object equivalent overrides the container default encoder. Developers are notified when transmission is complete through the supplied callback object.

Parameters
data:Object

the object being sent.

handler:SendHandler

the handler that will be notified of progress, must not be null.

Annotations
@Override
sendObjectback to summary
public Future<Void> sendObject(Object data)

Implements jakarta.websocket.RemoteEndpoint.Async.sendObject.

Doc from jakarta.websocket.RemoteEndpoint.Async.sendObject.

Initiates the asynchronous transmission of a custom developer object. The developer will have provided an encoder for this object type in the endpoint configuration. Containers will by default be able to encode java primitive types and their object equivalents, otherwise the developer must have provided an encoder for the object type in the endpoint configuration. A developer-provided encoder for a Java primitive type and its object equivalent overrides the container default encoder. Progress may be tracked using the Future object. The Future's get() methods return null upon successful completion. Errors in transmission are wrapped in the java.util.concurrent.ExecutionException thrown when querying the Future object.

Parameters
data:Object

the object being sent.

Returns:Future<Void>

the Future object representing the send operation.

Annotations
@Override
sendTextback to summary
public void sendText(String text, SendHandler handler)

Implements jakarta.websocket.RemoteEndpoint.Async.sendText.

Doc from jakarta.websocket.RemoteEndpoint.Async.sendText.

Initiates the asynchronous transmission of a text message. This method returns before the message is transmitted. Developers provide a callback to be notified when the message has been transmitted. Errors in transmission are given to the developer in the SendResult object.

Parameters
text:String

the text being sent.

handler:SendHandler

the handler which will be notified of progress.

Annotations
@Override
sendTextback to summary
public Future<Void> sendText(String text)

Implements jakarta.websocket.RemoteEndpoint.Async.sendText.

Doc from jakarta.websocket.RemoteEndpoint.Async.sendText.

Initiates the asynchronous transmission of a text message. This method returns before the message is transmitted. Developers use the returned Future object to track progress of the transmission. The Future's get() method returns null upon successful completion. Errors in transmission are wrapped in the java.util.concurrent.ExecutionException thrown when querying the Future object.

Parameters
text:String

the text being sent.

Returns:Future<Void>

the Future object representing the send operation.

Annotations
@Override
setSendTimeoutback to summary
public void setSendTimeout(long timeoutmillis)

Implements jakarta.websocket.RemoteEndpoint.Async.setSendTimeout.

Doc from jakarta.websocket.RemoteEndpoint.Async.setSendTimeout.

Sets the number of milliseconds the implementation will timeout attempting to send a websocket message. A zero or negative value indicates the implementation will not timeout attempting to send a websocket message asynchronously. This value overrides the default value assigned in the WebSocketContainer.

Parameters
timeoutmillis:long

The number of milliseconds this RemoteEndpoint will wait before timing out an incomplete asynchronous message send.

Annotations
@Override
org.glassfish.tyrus.core back to summary

private final Enum TyrusRemoteEndpoint.Async.AsyncMessageType

extends Enum<TyrusRemoteEndpoint.Async.AsyncMessageType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final TyrusRemoteEndpoint.Async.AsyncMessageType
public static final TyrusRemoteEndpoint.Async.AsyncMessageType
public static final TyrusRemoteEndpoint.Async.AsyncMessageType

Constructor Summary

AccessConstructor and Description
private

Field Detail

BINARYback to summary
public static final TyrusRemoteEndpoint.Async.AsyncMessageType BINARY
OBJECTback to summary
public static final TyrusRemoteEndpoint.Async.AsyncMessageType OBJECT
TEXTback to summary
public static final TyrusRemoteEndpoint.Async.AsyncMessageType TEXT

Constructor Detail

AsyncMessageTypeback to summary
private AsyncMessageType()

Method Detail

valueOfback to summary
public static TyrusRemoteEndpoint.Async.AsyncMessageType valueOf(String name)
valuesback to summary
public static TyrusRemoteEndpoint.Async.AsyncMessageType[] values()
org.glassfish.tyrus.core back to summary

pack-priv Class TyrusRemoteEndpoint.Basic

extends TyrusRemoteEndpoint
implements Basic
Class Inheritance
All Implemented Interfaces
jakarta.websocket.RemoteEndpoint.Basic, jakarta.websocket.RemoteEndpoint

Field Summary

Inherited from org.glassfish.tyrus.core.TyrusRemoteEndpoint:
sessionwebSocket

Constructor Summary

AccessConstructor and Description
pack-priv
Basic(TyrusSession session, TyrusWebSocket socket, TyrusEndpointWrapper endpointWrapper)

Method Summary

Modifier and TypeMethod and Description
public OutputStream
getSendStream()

Implements jakarta.websocket.RemoteEndpoint.Basic.getSendStream.

Opens an output stream on which a binary message may be sent.

public Writer
getSendWriter()

Implements jakarta.websocket.RemoteEndpoint.Basic.getSendWriter.

Opens a character stream on which a text message may be sent.

private void
processFuture(Future<?>
to be processed.
future
)

Wait for the future to be completed.

public void
sendBinary(ByteBuffer
the message to be sent.
data
)

Implements jakarta.websocket.RemoteEndpoint.Basic.sendBinary.

Send a binary message, returning when all of the message has been transmitted.

public void
sendBinary(ByteBuffer
the part of the message being sent.
partialByte
,
boolean
Whether the partial message being sent is the last part of the message.
isLast
)

Implements jakarta.websocket.RemoteEndpoint.Basic.sendBinary.

Send a binary message in parts, blocking until all of the message has been transmitted.

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

Implements jakarta.websocket.RemoteEndpoint.Basic.sendObject.

Sends a custom developer object, blocking until it has been transmitted.

public void
sendText(String
the message to be sent.
text
)

Implements jakarta.websocket.RemoteEndpoint.Basic.sendText.

Send a text message, blocking until all of the message has been transmitted.

public void
sendText(String
the parts of the message being sent.
partialMessage
,
boolean
Whether the partial message being sent is the last part of the message.
isLast
)

Implements jakarta.websocket.RemoteEndpoint.Basic.sendText.

Send a text message in parts, blocking until all of the message has been transmitted.

Inherited from org.glassfish.tyrus.core.TyrusRemoteEndpoint:
closeflushBatchgetBatchingAllowedsendPingsendPongsendSyncObjectsendSyncObjectsetBatchingAllowedtoString

Constructor Detail

Basicback to summary
pack-priv Basic(TyrusSession session, TyrusWebSocket socket, TyrusEndpointWrapper endpointWrapper)

Method Detail

getSendStreamback to summary
public OutputStream getSendStream() throws IOException

Implements jakarta.websocket.RemoteEndpoint.Basic.getSendStream.

Doc from jakarta.websocket.RemoteEndpoint.Basic.getSendStream.

Opens an output stream on which a binary message may be sent. The developer must close the output stream in order to indicate that the complete message has been placed into the output stream. If no calls are made to one of the write() methods before the output stream is closed then no WebSocket binary messages will be sent. If at least one call is made to one of the write() methods before the output stream is closed then at least one WebSocket binary message will be sent even if that message is of zero length.

Returns:OutputStream

the output stream to which the message will be written.

Annotations
@Override
Exceptions
IOException:
if there is a problem obtaining the OutputStream to write the binary message.
getSendWriterback to summary
public Writer getSendWriter() throws IOException

Implements jakarta.websocket.RemoteEndpoint.Basic.getSendWriter.

Doc from jakarta.websocket.RemoteEndpoint.Basic.getSendWriter.

Opens a character stream on which a text message may be sent. The developer must close the writer in order to indicate that the complete message has been placed into the character stream. If no calls are made to one of the write() or append() methods before the writer is closed then no WebSocket text messages will be sent. If at least one call is made to one of the write() or append() methods before the writer is closed then at least one WebSocket text message will be sent even if that message is of zero length.

Returns:Writer

the writer to which the message will be written.

Annotations
@Override
Exceptions
IOException:
if there is a problem obtaining the Writer to write the text message.
processFutureback to summary
private void processFuture(Future<?> future) throws IOException

Wait for the future to be completed.

java.util.concurrent.Future#get() will be invoked and exception processed (if thrown).

Parameters
future:Future<?>

to be processed.

Exceptions
IOException:
when java.io.IOException is the cause of thrown java.util.concurrent.ExecutionException it will be extracted and rethrown. Otherwise whole ExecutionException will be rethrown wrapped in java.io.IOException.
sendBinaryback to summary
public void sendBinary(ByteBuffer data) throws IOException

Implements jakarta.websocket.RemoteEndpoint.Basic.sendBinary.

Doc from jakarta.websocket.RemoteEndpoint.Basic.sendBinary.

Send a binary message, returning when all of the message has been transmitted.

It is not safe for other threads to use the ByteBuffer until the sending of this message is complete. If the sending of the message completes successfully, the buffer's limit will be unchanged and the buffer's position will be equal to the limit. If the sending of the message does not complete successfully, the state of the buffer is undefined.

Parameters
data:ByteBuffer

the message to be sent.

Annotations
@Override
Exceptions
IOException:
if there is a problem delivering the message.
sendBinaryback to summary
public void sendBinary(ByteBuffer partialByte, boolean isLast) throws IOException

Implements jakarta.websocket.RemoteEndpoint.Basic.sendBinary.

Doc from jakarta.websocket.RemoteEndpoint.Basic.sendBinary.

Send a binary message in parts, blocking until all of the message has been transmitted. The runtime reads the message in order. Non-final parts are sent with isLast set to false. The final piece must be sent with isLast set to true.

It is not safe for other threads to use the ByteBuffer until the sending of this partial message is complete. If the sending of the partial message completes successfully, the buffer's limit will be unchanged and the buffer's position will be equal to the limit. If the sending of the partial message does not complete successfully, the state of the buffer is undefined.

Parameters
partialByte:ByteBuffer

the part of the message being sent.

isLast:boolean

Whether the partial message being sent is the last part of the message.

Annotations
@Override
Exceptions
IOException:
if there is a problem delivering the partial message.
sendObjectback to summary
public void sendObject(Object data) throws IOException, EncodeException

Implements jakarta.websocket.RemoteEndpoint.Basic.sendObject.

Doc from jakarta.websocket.RemoteEndpoint.Basic.sendObject.

Sends a custom developer object, blocking until it has been transmitted. Containers will by default be able to encode java primitive types and their object equivalents, otherwise the developer must have provided an encoder for the object type in the endpoint configuration. A developer-provided encoder for a Java primitive type and its object equivalent overrides the container default encoder.

Parameters
data:Object

the object to be sent.

Annotations
@Override
Exceptions
IOException:
if there is a communication error sending the message object.
EncodeException:
if there was a problem encoding the message object into the form of a native websocket message.
sendTextback to summary
public void sendText(String text) throws IOException

Implements jakarta.websocket.RemoteEndpoint.Basic.sendText.

Doc from jakarta.websocket.RemoteEndpoint.Basic.sendText.

Send a text message, blocking until all of the message has been transmitted.

Parameters
text:String

the message to be sent.

Annotations
@Override
Exceptions
IOException:
if there is a problem delivering the message.
sendTextback to summary
public void sendText(String partialMessage, boolean isLast) throws IOException

Implements jakarta.websocket.RemoteEndpoint.Basic.sendText.

Doc from jakarta.websocket.RemoteEndpoint.Basic.sendText.

Send a text message in parts, blocking until all of the message has been transmitted. The runtime reads the message in order. Non-final parts of the message are sent with isLast set to false. The final part must be sent with isLast set to true.

Parameters
partialMessage:String

the parts of the message being sent.

isLast:boolean

Whether the partial message being sent is the last part of the message.

Annotations
@Override
Exceptions
IOException:
if there is a problem delivering the message fragment.