Top Fields Constructors Methods
org.eclipse.jetty.ee10.websocket.jakarta.common

public Class JakartaWebSocketRemoteEndpoint

extends Object
implements RemoteEndpoint, OutgoingFrames
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.websocket.core.OutgoingFrames, jakarta.websocket.RemoteEndpoint
Known Direct Subclasses
org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketAsyncRemote, org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketBasicRemote
Imports
java.io.IOException, java.nio.ByteBuffer, java.time.Duration, jakarta.websocket.EncodeException, .Encoder, .SendHandler, org.eclipse.jetty.util.BufferUtil, .Callback, .FutureCallback, org.eclipse.jetty.websocket.core.CoreSession, .Frame, .OpCode, .OutgoingFrames, org.eclipse.jetty.websocket.core.exception.WebSocketException, org.eclipse.jetty.websocket.core.messages.MessageOutputStream, .MessageWriter, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
protected boolean
private final CoreSession
private static final Logger
protected byte
protected final JakartaWebSocketSession

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected void
protected 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 long
public long
protected MessageOutputStream
protected MessageWriter
public void
sendFrame(Frame
the frame to eventually write to the network layer.
frame
,
Callback
the callback to notify when the frame is written.
callback
,
boolean
the batch mode requested by the sender.
batch
)

Implements org.eclipse.jetty.websocket.core.OutgoingFrames.sendFrame.

A frame, and optional callback, intended for the network layer.

public void
sendObject(Object data, Callback callback)

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

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.
data
)

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.

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 void
setIdleTimeout(long ms)

public void
setWriteTimeout(long ms)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

batchback to summary
protected boolean batch
coreSessionback to summary
private final CoreSession coreSession
LOGback to summary
private static final Logger LOG
messageTypeback to summary
protected byte messageType
sessionback to summary
protected final JakartaWebSocketSession session

Constructor Detail

JakartaWebSocketRemoteEndpointback to summary
protected JakartaWebSocketRemoteEndpoint(JakartaWebSocketSession session, CoreSession coreSession)

Method Detail

assertMessageNotNullback to summary
protected void assertMessageNotNull(Object data)
assertSendHandlerNotNullback to summary
protected void assertSendHandlerNotNull(SendHandler handler)
flushBatchback to summary
public void flushBatch() throws IOException

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
Exceptions
IOException:
if the sending of any unsent messages failed
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
getIdleTimeoutback to summary
public long getIdleTimeout()
getWriteTimeoutback to summary
public long getWriteTimeout()
newMessageOutputStreamback to summary
protected MessageOutputStream newMessageOutputStream()
newMessageWriterback to summary
protected MessageWriter newMessageWriter()
sendFrameback to summary
public void sendFrame(Frame frame, Callback callback, boolean batch)

Implements org.eclipse.jetty.websocket.core.OutgoingFrames.sendFrame.

Doc from org.eclipse.jetty.websocket.core.OutgoingFrames.sendFrame.

A frame, and optional callback, intended for the network layer.

Note

the frame can undergo many transformations in the various layers and extensions present in the implementation.

If you are implementing a mutation, you are obliged to handle the incoming Callback appropriately.

Parameters
frame:Frame

the frame to eventually write to the network layer.

callback:Callback

the callback to notify when the frame is written.

batch:boolean

the batch mode requested by the sender.

Annotations
@Override
sendObjectback to summary
public void sendObject(Object data, Callback callback) throws IOException, EncodeException
sendPingback to summary
public void sendPing(ByteBuffer data) throws IOException, IllegalArgumentException

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
data:ByteBuffer

the data to be carried in the ping request.

Annotations
@Override
Exceptions
IOException:
if the ping failed to be sent
IllegalArgumentException:
if the applicationData exceeds the maximum allowed payload of 125 bytes
sendPongback to summary
public void sendPong(ByteBuffer data) throws IOException, IllegalArgumentException

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
data:ByteBuffer

the application data to be carried in the pong response.

Annotations
@Override
Exceptions
IOException:
if the pong failed to be sent
IllegalArgumentException:
if the applicationData exceeds the maximum allowed payload of 125 bytes
setBatchingAllowedback to summary
public void setBatchingAllowed(boolean allowed) throws IOException

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
Exceptions
IOException:
if batching is being disabled and there are unsent messages this error may be thrown as the implementation sends the batch of unsent messages if there is a problem.
setIdleTimeoutback to summary
public void setIdleTimeout(long ms)
setWriteTimeoutback to summary
public void setWriteTimeout(long ms)