public interface WebSocket
| Modifier and Type | Interface and Description |
|---|---|
static class |
WebSocket.READYSTATE |
static class |
WebSocket.Role |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_PORT
The default port of WebSockets, as defined in the spec.
|
static int |
DEFAULT_WSS_PORT |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Convenience function which behaves like close(CloseFrame.NORMAL)
|
void |
close(int code) |
void |
close(int code,
java.lang.String message)
sends the closing handshake.
|
void |
closeConnection(int code,
java.lang.String message)
This will close the connection immediately without a proper close handshake.
|
Draft |
getDraft() |
java.net.InetSocketAddress |
getLocalSocketAddress() |
WebSocket.READYSTATE |
getReadyState()
Retrieve the WebSocket 'readyState'.
|
java.net.InetSocketAddress |
getRemoteSocketAddress() |
boolean |
hasBufferedData() |
boolean |
isClosed()
Returns whether the close handshake has been completed and the socket is closed.
|
boolean |
isClosing() |
boolean |
isConnecting() |
boolean |
isFlushAndClose()
Returns true when no further frames may be submitted
This happens before the socket connection is closed. |
boolean |
isOpen() |
void |
send(byte[] bytes) |
void |
send(java.nio.ByteBuffer bytes)
Send Binary data (plain bytes) to the other end.
|
void |
send(java.lang.String text)
Send Text data to the other end.
|
void |
sendFrame(Framedata framedata) |
static final int DEFAULT_PORT
static final int DEFAULT_WSS_PORT
void close(int code,
java.lang.String message)
void close(int code)
void close()
void closeConnection(int code,
java.lang.String message)
void send(java.lang.String text) throws java.nio.channels.NotYetConnectedException
java.lang.IllegalArgumentExceptionjava.nio.channels.NotYetConnectedExceptionvoid send(java.nio.ByteBuffer bytes)
throws java.lang.IllegalArgumentException,
java.nio.channels.NotYetConnectedException
java.lang.IllegalArgumentExceptionjava.nio.channels.NotYetConnectedExceptionvoid send(byte[] bytes)
throws java.lang.IllegalArgumentException,
java.nio.channels.NotYetConnectedException
java.lang.IllegalArgumentExceptionjava.nio.channels.NotYetConnectedExceptionvoid sendFrame(Framedata framedata)
boolean hasBufferedData()
java.net.InetSocketAddress getRemoteSocketAddress()
java.net.InetSocketAddress getLocalSocketAddress()
boolean isConnecting()
boolean isOpen()
boolean isClosing()
boolean isFlushAndClose()
boolean isClosed()
Draft getDraft()
WebSocket.READYSTATE getReadyState()