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,
String message)
sends the closing handshake.
|
void |
closeConnection(int code,
String message)
This will close the connection immediately without a proper close handshake.
|
Draft |
getDraft() |
InetSocketAddress |
getLocalSocketAddress() |
WebSocket.READYSTATE |
getReadyState()
Retrieve the WebSocket 'readyState'.
|
InetSocketAddress |
getRemoteSocketAddress() |
String |
getResourceDescriptor()
Returns the HTTP Request-URI as defined by http://tools.ietf.org/html/rfc2616#section-5.1.2
If the opening handshake has not yet happened it will return null. |
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(ByteBuffer bytes)
Send Binary data (plain bytes) to the other end.
|
void |
send(String text)
Send Text data to the other end.
|
void |
sendFragmentedFrame(Framedata.Opcode op,
ByteBuffer buffer,
boolean fin)
Allows to send continuous/fragmented frames conveniently.
|
void |
sendFrame(Framedata framedata) |
static final int DEFAULT_PORT
static final int DEFAULT_WSS_PORT
void close(int code, String message)
void close(int code)
void close()
void closeConnection(int code, String message)
void send(String text) throws NotYetConnectedException
void send(ByteBuffer bytes) throws IllegalArgumentException, NotYetConnectedException
void send(byte[] bytes) throws IllegalArgumentException, NotYetConnectedException
void sendFrame(Framedata framedata)
void sendFragmentedFrame(Framedata.Opcode op, ByteBuffer buffer, boolean fin)
op
- This is only important for the first frame in the sequence. Opcode.TEXT, Opcode.BINARY are allowed.buffer
- The buffer which contains the payload. It may have no bytes remaining.fin
- true means the current frame is the last in the sequence.boolean hasBufferedData()
InetSocketAddress getRemoteSocketAddress()
InetSocketAddress getLocalSocketAddress()
boolean isConnecting()
boolean isOpen()
boolean isClosing()
boolean isFlushAndClose()
boolean isClosed()
Draft getDraft()
WebSocket.READYSTATE getReadyState()
String getResourceDescriptor()
Copyright © 2016. All rights reserved.