public final class RemoteEndpointWrapper<T> extends Object implements RemoteEndpoint<T>
RemoteEndpoint and represents the other side of the websocket connection.| Modifier and Type | Method and Description |
|---|---|
void |
close(CloseReason cr) |
String |
getAddress()
URI to which the remote originally connected.
|
static RemoteEndpointWrapper |
getRemoteWrapper(RemoteEndpoint socket,
EndpointWrapper application)
Get the RemoteEndpoint wrapper.
|
OutputStream |
getSendStream()
Opens an output stream on which a binary message may be sent.
|
Writer |
getSendWriter()
Opens an character stream on which a text message may be sent.
|
Session |
getSession() |
boolean |
isConnected()
The endpoint is connected.
|
void |
sendBytes(ByteBuffer data)
Send a binary message, returning when all of the message has been transmitted.
|
Future<SendResult> |
sendBytes(ByteBuffer data,
SendHandler completion)
Initiates the asynchronous transmission of a binary message.
|
void |
sendObject(T o)
Sends a custom developer object, blocking until it has been transmitted.
|
Future<SendResult> |
sendObject(T o,
SendHandler handler)
Initiates the transmission of a custom developer object.
|
void |
sendPartialBytes(ByteBuffer byteBuffer,
boolean isLast)
Send a binary message in pieces, blocking until all of the message has been transmitted.
|
void |
sendPartialString(String fragment,
boolean isLast)
Send a text message in pieces, blocking until all of the message has been transmitted.
|
void |
sendPing(ByteBuffer applicationData)
Send a Ping message containing the given application data to the remote endpoint.
|
void |
sendPong(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 |
sendString(String data)
Send a text message, blocking until all of the message has been transmitted.
|
Future<SendResult> |
sendString(String text,
SendHandler completion)
Initiates the asynchronous transmission of a text message.
|
String |
toString() |
void |
updateLastConnectionActivity() |
public static RemoteEndpointWrapper getRemoteWrapper(RemoteEndpoint socket, EndpointWrapper application)
socket - socket corresponding to the required wrapperapplication - web socket endpoint for which the wrapper represents the other side of the connectionpublic String getAddress()
public boolean isConnected()
true iff the endpoint is connected, false otherwise.public void sendString(String data) throws IOException
RemoteEndpointsendString in interface RemoteEndpoint<T>data - the message to be sent.IOExceptionpublic void sendBytes(ByteBuffer data) throws IOException
RemoteEndpointsendBytes in interface RemoteEndpoint<T>data - the message to be sent.IOExceptionpublic void sendPartialString(String fragment, boolean isLast) throws IOException
RemoteEndpointsendPartialString in interface RemoteEndpoint<T>fragment - the piece of the message being sent.IOExceptionpublic void sendPartialBytes(ByteBuffer byteBuffer, boolean isLast) throws IOException
RemoteEndpointsendPartialBytes in interface RemoteEndpoint<T>byteBuffer - the piece of the message being sent.IOExceptionpublic OutputStream getSendStream() throws IOException
RemoteEndpointgetSendStream in interface RemoteEndpoint<T>IOExceptionpublic Writer getSendWriter() throws IOException
RemoteEndpointgetSendWriter in interface RemoteEndpoint<T>IOExceptionpublic void sendObject(T o) throws IOException, EncodeException
RemoteEndpointsendObject in interface RemoteEndpoint<T>o - the object to be sent.IOExceptionEncodeExceptionpublic Future<SendResult> sendString(String text, SendHandler completion)
RemoteEndpointsendString in interface RemoteEndpoint<T>text - the text being sent.completion - the handler which will be notified of progress.public Future<SendResult> sendBytes(ByteBuffer data, SendHandler completion)
RemoteEndpointsendBytes in interface RemoteEndpoint<T>data - the data being sent.completion - the handler that will be notified of progress.public Future<SendResult> sendObject(T o, SendHandler handler)
RemoteEndpointsendObject in interface RemoteEndpoint<T>o - the object being sent.public void sendPing(ByteBuffer applicationData)
RemoteEndpointsendPing in interface RemoteEndpoint<T>applicationData - the data to be carried in the ping request.public void sendPong(ByteBuffer applicationData)
RemoteEndpointsendPong in interface RemoteEndpoint<T>applicationData - the application data to be carried in the pong response.public void close(CloseReason cr) throws IOException
IOExceptionpublic Session getSession()
public void updateLastConnectionActivity()
Copyright © 2012. All Rights Reserved.