public interface WebSocket extends Closeable
| Modifier and Type | Method and Description |
|---|---|
WebSocket |
addWebSocketListener(WebSocketListener l)
Add a
WebSocketListener |
SocketAddress |
getLocalAddress()
Get local address client initiated request from.
|
SocketAddress |
getRemoteAddress()
Get remote address client initiated request to.
|
boolean |
isOpen() |
WebSocket |
removeWebSocketListener(WebSocketListener l)
Remove a
WebSocketListener |
WebSocket |
sendMessage(byte[] message)
Send a byte message.
|
WebSocket |
sendMessage(String message)
Send a text message
|
WebSocket |
sendPing(byte[] payload)
Send a
ping with an optional payload
(limited to 125 bytes or less). |
WebSocket |
sendPong(byte[] payload)
Send a
ping with an optional payload
(limited to 125 bytes or less). |
WebSocket |
stream(byte[] fragment,
boolean last)
Allows streaming of multiple binary fragments.
|
WebSocket |
stream(byte[] fragment,
int offset,
int len,
boolean last)
Allows streaming of multiple binary fragments.
|
WebSocket |
stream(String fragment,
boolean last)
Allows streaming of multiple text fragments.
|
SocketAddress getRemoteAddress()
null
if asynchronous provider is unable to provide the remote addressSocketAddress getLocalAddress()
null
if asynchronous provider is unable to provide the local addressWebSocket sendMessage(byte[] message)
message - a byte messageWebSocket stream(byte[] fragment, boolean last)
fragment - binary fragment.last - flag indicating whether or not this is the last fragment.WebSocket stream(byte[] fragment, int offset, int len, boolean last)
fragment - binary fragment.offset - starting offset.len - length.last - flag indicating whether or not this is the last fragment.WebSocket sendMessage(String message)
message - a text messageWebSocket stream(String fragment, boolean last)
fragment - text fragment.last - flag indicating whether or not this is the last fragment.WebSocket sendPing(byte[] payload)
ping with an optional payload
(limited to 125 bytes or less).payload - the ping payload.WebSocket sendPong(byte[] payload)
ping with an optional payload
(limited to 125 bytes or less).payload - the pong payload.WebSocket addWebSocketListener(WebSocketListener l)
WebSocketListenerl - a WebSocketListenerWebSocket removeWebSocketListener(WebSocketListener l)
WebSocketListenerl - a WebSocketListenerboolean isOpen()
true if the WebSocket is open/connected.Copyright © 2016. All Rights Reserved.