jakarta.websocket.RemoteEndpoint and represents the other side of the websocket connection.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private final TyrusEndpointWrapper | |
| private static final Logger | |
| pack-priv final TyrusSession | |
| pack-priv final TyrusWebSocket |
| Access | Constructor and Description |
|---|---|
| private | TyrusRemoteEndpoint(TyrusSession session, TyrusWebSocket socket, TyrusEndpointWrapper endpointWrapper)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | flushBatch()
Implements jakarta. This method is only used when batching is allowed for this RemoteEndpint. |
| public boolean | getBatchingAllowed()
Implements jakarta. 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. 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. 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 | |
| public void | setBatchingAllowed(boolean
whether the implementation is allowed to batch messages. allowed)Implements jakarta. Indicate to the implementation that it is allowed to batch outgoing messages before sending. |
| public String |
| endpointWrapper | back to summary |
|---|---|
| private final TyrusEndpointWrapper endpointWrapper | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| session | back to summary |
|---|---|
| pack-priv final TyrusSession session | |
| webSocket | back to summary |
|---|---|
| pack-priv final TyrusWebSocket webSocket | |
| TyrusRemoteEndpoint | back to summary |
|---|---|
| private TyrusRemoteEndpoint(TyrusSession session, TyrusWebSocket socket, TyrusEndpointWrapper endpointWrapper) | |
| close | back to summary |
|---|---|
| public void close(CloseReason cr) | |
| flushBatch | back to summary |
|---|---|
| public void flushBatch() Implements jakarta. Doc from jakarta. 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.
| |
| getBatchingAllowed | back to summary |
|---|---|
| public boolean getBatchingAllowed() Implements jakarta. Doc from jakarta. 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
| |
| sendPing | back to summary |
|---|---|
| public void sendPing(ByteBuffer applicationData) throws IOException Implements jakarta. Doc from jakarta. 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.
| |
| sendPong | back to summary |
|---|---|
| public void sendPong(ByteBuffer applicationData) throws IOException Implements jakarta. Doc from jakarta. 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.
| |
| sendSyncObject | back to summary |
|---|---|
pack-priv Future
| |
| sendSyncObject | back to summary |
|---|---|
pack-priv void sendSyncObject(Object o, SendHandler handler, WriterInfo writerInfo)
| |
| setBatchingAllowed | back to summary |
|---|---|
| public void setBatchingAllowed(boolean allowed) Implements jakarta. Doc from jakarta. 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.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Class and Description |
|---|---|
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public long | getSendTimeout()
Implements jakarta. Return the number of milliseconds the implementation will timeout attempting to send a websocket message. |
| private Future | Returns: message sending callbackFuturemessage to be sent message, final TyrusRemoteEndpoint.message type typeSends the message asynchronously. |
| private void | sendAsync(final Object
message to be sent message, final SendHandler message sending callback handler handler, final TyrusRemoteEndpoint.message type typeSends the message asynchronously. |
| public Future | sendBinary(ByteBuffer
the data being sent. data)Implements jakarta. Initiates the asynchronous transmission of a binary message. |
| public void | sendBinary(ByteBuffer
the data being sent, must not be data, SendHandler null.the handler that will be notified of progress, must not be handler)null.Implements jakarta. 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 handler)null.Implements jakarta. Initiates the asynchronous transmission of a custom developer object. |
| public Future | sendObject(Object
the object being sent. data)Implements jakarta. 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. Initiates the asynchronous transmission of a text message. |
| public Future | sendText(String
the text being sent. text)Implements jakarta. 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. Sets the number of milliseconds the implementation will timeout attempting to send a websocket message. |
| sendTimeout | back to summary |
|---|---|
| private long sendTimeout | |
| Async | back to summary |
|---|---|
| pack-priv Async(TyrusSession session, TyrusWebSocket socket, TyrusEndpointWrapper endpointWrapper) | |
| getSendTimeout | back to summary |
|---|---|
| public long getSendTimeout() Implements jakarta. Doc from jakarta. 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.
| |
| sendAsync | back to summary |
|---|---|
| private Future 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().
| |
| sendAsync | back to summary |
|---|---|
| private void sendAsync(final Object message, final SendHandler handler, final TyrusRemoteEndpoint. 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().
| |
| sendBinary | back to summary |
|---|---|
| public Future Implements jakarta. Doc from jakarta. 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 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.
| |
| sendBinary | back to summary |
|---|---|
| public void sendBinary(ByteBuffer data, SendHandler handler) Implements jakarta. Doc from jakarta. 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.
| |
| sendObject | back to summary |
|---|---|
| public void sendObject(Object data, SendHandler handler) Implements jakarta. Doc from jakarta. 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.
| |
| sendObject | back to summary |
|---|---|
| public Future Implements jakarta. Doc from jakarta. 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 | |
| sendText | back to summary |
|---|---|
| public void sendText(String text, SendHandler handler) Implements jakarta. Doc from jakarta. 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.
| |
| sendText | back to summary |
|---|---|
| public Future Implements jakarta. Doc from jakarta. 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 | |
| setSendTimeout | back to summary |
|---|---|
| public void setSendTimeout(long timeoutmillis) Implements jakarta. Doc from jakarta. 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.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final TyrusRemoteEndpoint. | |
| public static final TyrusRemoteEndpoint. | |
| public static final TyrusRemoteEndpoint. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static TyrusRemoteEndpoint. | |
| public static TyrusRemoteEndpoint. |
| BINARY | back to summary |
|---|---|
| public static final TyrusRemoteEndpoint. | |
| OBJECT | back to summary |
|---|---|
| public static final TyrusRemoteEndpoint. | |
| TEXT | back to summary |
|---|---|
| public static final TyrusRemoteEndpoint. | |
| AsyncMessageType | back to summary |
|---|---|
| private AsyncMessageType() | |
| valueOf | back to summary |
|---|---|
| public static TyrusRemoteEndpoint. | |
| values | back to summary |
|---|---|
| public static TyrusRemoteEndpoint. | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public OutputStream | getSendStream()
Implements jakarta. Opens an output stream on which a binary message may be sent. |
| public Writer | getSendWriter()
Implements jakarta. Opens a character stream on which a text message may be sent. |
| private void | |
| public void | sendBinary(ByteBuffer
the message to be sent. data)Implements jakarta. 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. 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. Sends a custom developer object, blocking until it has been transmitted. |
| public void | sendText(String
the message to be sent. text)Implements jakarta. 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. Send a text message in parts, blocking until all of the message has been transmitted. |
| Basic | back to summary |
|---|---|
| pack-priv Basic(TyrusSession session, TyrusWebSocket socket, TyrusEndpointWrapper endpointWrapper) | |
| getSendStream | back to summary |
|---|---|
| public OutputStream getSendStream() throws IOException Implements jakarta. Doc from jakarta. 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
| |
| getSendWriter | back to summary |
|---|---|
| public Writer getSendWriter() throws IOException Implements jakarta. Doc from jakarta. 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
| |
| processFuture | back to summary |
|---|---|
| private void processFuture(Future<?> future) throws IOException Wait for the future to be completed.
| |
| sendBinary | back to summary |
|---|---|
| public void sendBinary(ByteBuffer data) throws IOException Implements jakarta. Doc from jakarta. 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.
| |
| sendBinary | back to summary |
|---|---|
| public void sendBinary(ByteBuffer partialByte, boolean isLast) throws IOException Implements jakarta. Doc from jakarta. 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.
| |
| sendObject | back to summary |
|---|---|
| public void sendObject(Object data) throws IOException, EncodeException Implements jakarta. Doc from jakarta. 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.
| |
| sendText | back to summary |
|---|---|
| public void sendText(String text) throws IOException Implements jakarta. Doc from jakarta. Send a text message, blocking until all of the message has been transmitted.
| |
| sendText | back to summary |
|---|---|
| public void sendText(String partialMessage, boolean isLast) throws IOException Implements jakarta. Doc from jakarta. 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.
| |