public class WebSocketRemoteEndpoint extends Object implements RemoteEndpoint
Constructor and Description |
---|
WebSocketRemoteEndpoint(LogicalConnection connection,
OutgoingFrames outgoing) |
WebSocketRemoteEndpoint(LogicalConnection connection,
OutgoingFrames outgoing,
BatchMode batchMode) |
Modifier and Type | Method and Description |
---|---|
void |
flush()
Flushes messages that may have been batched by the implementation.
|
BatchMode |
getBatchMode() |
InetSocketAddress |
getInetSocketAddress() |
void |
sendBytes(ByteBuffer data)
Blocking write of bytes.
|
void |
sendBytes(ByteBuffer data,
WriteCallback callback)
Initiates the asynchronous transmission of a binary message.
|
Future<Void> |
sendBytesByFuture(ByteBuffer data)
Initiates the asynchronous transmission of a binary message.
|
void |
sendPartialBytes(ByteBuffer fragment,
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 text)
Send a text message, blocking until all bytes of the message has been transmitted.
|
void |
sendString(String text,
WriteCallback callback)
Initiates the asynchronous transmission of a text message.
|
Future<Void> |
sendStringByFuture(String text)
Initiates the asynchronous transmission of a text message.
|
void |
setBatchMode(BatchMode batchMode) |
String |
toString() |
void |
uncheckedSendFrame(WebSocketFrame frame,
WriteCallback callback) |
public WebSocketRemoteEndpoint(LogicalConnection connection, OutgoingFrames outgoing)
public WebSocketRemoteEndpoint(LogicalConnection connection, OutgoingFrames outgoing, BatchMode batchMode)
public InetSocketAddress getInetSocketAddress()
public void sendBytes(ByteBuffer data) throws IOException
sendBytes
in interface RemoteEndpoint
data
- the message to be sentIOException
- if unable to send the bytespublic Future<Void> sendBytesByFuture(ByteBuffer data)
RemoteEndpoint
sendBytesByFuture
in interface RemoteEndpoint
data
- the data being sentpublic void sendBytes(ByteBuffer data, WriteCallback callback)
RemoteEndpoint
sendBytes
in interface RemoteEndpoint
data
- the data being sentcallback
- callback to notify of success or failure of the write operationpublic void uncheckedSendFrame(WebSocketFrame frame, WriteCallback callback)
public void sendPartialBytes(ByteBuffer fragment, boolean isLast) throws IOException
RemoteEndpoint
sendPartialBytes
in interface RemoteEndpoint
fragment
- the piece of the message being sentisLast
- true if this is the last piece of the partial bytesIOException
- if unable to send the partial bytespublic void sendPartialString(String fragment, boolean isLast) throws IOException
RemoteEndpoint
sendPartialString
in interface RemoteEndpoint
fragment
- the piece of the message being sentisLast
- true if this is the last piece of the partial bytesIOException
- if unable to send the partial bytespublic void sendPing(ByteBuffer applicationData) throws IOException
RemoteEndpoint
sendPing
in interface RemoteEndpoint
applicationData
- the data to be carried in the ping requestIOException
- if unable to send the pingpublic void sendPong(ByteBuffer applicationData) throws IOException
RemoteEndpoint
sendPong
in interface RemoteEndpoint
applicationData
- the application data to be carried in the pong response.IOException
- if unable to send the pongpublic void sendString(String text) throws IOException
RemoteEndpoint
Note: this is a blocking call
sendString
in interface RemoteEndpoint
text
- the message to be sentIOException
- if unable to send the text messagepublic Future<Void> sendStringByFuture(String text)
RemoteEndpoint
sendStringByFuture
in interface RemoteEndpoint
text
- the text being sentpublic void sendString(String text, WriteCallback callback)
RemoteEndpoint
sendString
in interface RemoteEndpoint
text
- the text being sentcallback
- callback to notify of success or failure of the write operationpublic BatchMode getBatchMode()
getBatchMode
in interface RemoteEndpoint
RemoteEndpoint.flush()
public void setBatchMode(BatchMode batchMode)
public void flush() throws IOException
RemoteEndpoint
flush
in interface RemoteEndpoint
IOException
- if the flush failsRemoteEndpoint.getBatchMode()
Copyright © 1995-2015 Webtide. All Rights Reserved.