Package org.glassfish.tyrus.core
Class TyrusRemoteEndpoint
- java.lang.Object
-
- org.glassfish.tyrus.core.TyrusRemoteEndpoint
-
- All Implemented Interfaces:
RemoteEndpoint
public abstract class TyrusRemoteEndpoint extends java.lang.Object implements RemoteEndpoint
Wraps theRemoteEndpoint
and represents the other side of the websocket connection.- Author:
- Danny Coward (danny.coward at oracle.com), Martin Matula (martin.matula at oracle.com), Stepan Kopriva (stepan.kopriva at oracle.com), Pavel Bucek (pavel.bucek at oracle.com)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close(CloseReason cr)
void
flushBatch()
This method is only used when batching is allowed for this RemoteEndpint.boolean
getBatchingAllowed()
Return whether the implementation is allowed to batch outgoing messages before sending.void
sendPing(java.nio.ByteBuffer applicationData)
Send a Ping message containing the given application data to the remote endpoint.void
sendPong(java.nio.ByteBuffer applicationData)
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.void
setBatchingAllowed(boolean allowed)
Indicate to the implementation that it is allowed to batch outgoing messages before sending.java.lang.String
toString()
-
-
-
Method Detail
-
sendPing
public void sendPing(java.nio.ByteBuffer applicationData) throws java.io.IOException
Description copied from interface:RemoteEndpoint
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.- Specified by:
sendPing
in interfaceRemoteEndpoint
- Parameters:
applicationData
- the data to be carried in the ping request.- Throws:
java.io.IOException
- if the ping failed to be sent
-
sendPong
public void sendPong(java.nio.ByteBuffer applicationData) throws java.io.IOException
Description copied from interface:RemoteEndpoint
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.- Specified by:
sendPong
in interfaceRemoteEndpoint
- Parameters:
applicationData
- the application data to be carried in the pong response.- Throws:
java.io.IOException
- if the pong failed to be sent
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
setBatchingAllowed
public void setBatchingAllowed(boolean allowed)
Description copied from interface:RemoteEndpoint
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.- Specified by:
setBatchingAllowed
in interfaceRemoteEndpoint
- Parameters:
allowed
- whether the implementation is allowed to batch messages.
-
getBatchingAllowed
public boolean getBatchingAllowed()
Description copied from interface:RemoteEndpoint
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 callingsetBatchingAllowed
.- Specified by:
getBatchingAllowed
in interfaceRemoteEndpoint
- Returns:
true
if the implementation is allowed to batch outgoing messages before sending, otherwisefalse
-
flushBatch
public void flushBatch()
Description copied from interface:RemoteEndpoint
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.- Specified by:
flushBatch
in interfaceRemoteEndpoint
-
close
public void close(CloseReason cr)
-
-