|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface WebSocket
General WebSocket unit interface.
| Field Summary | |
|---|---|
static int |
ABNORMAL_CLOSE
a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. |
static int |
END_POINT_GOING_DOWN
Indicates that an endpoint is "going away", such as a server going down, or a browser having navigated away from a page. |
static int |
INVALID_DATA
Indicates that an endpoint is terminating the connection because it has received a type of data it cannot accept (e.g. |
static int |
MESSAGE_TOO_LARGE
indicates that an endpoint is terminating the connection because it has received a message that is too large. |
static int |
NO_STATUS_CODE
a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. |
static int |
NORMAL_CLOSURE
Indicates a normal closure, meaning whatever purpose the connection was established for has been fulfilled. |
static int |
PROTOCOL_ERROR
Indicates that an endpoint is terminating the connection due to a protocol error. |
| Method Summary | |
|---|---|
boolean |
add(WebSocketListener listener)
|
void |
close()
|
void |
close(int code)
|
void |
close(int code,
String reason)
|
boolean |
isConnected()
|
void |
onClose(DataFrame frame)
|
void |
onConnect()
|
void |
onFragment(boolean last,
byte[] payload)
|
void |
onFragment(boolean last,
String payload)
|
void |
onMessage(byte[] data)
|
void |
onMessage(String text)
|
void |
onPing(DataFrame frame)
|
void |
onPong(DataFrame frame)
|
boolean |
remove(WebSocketListener listener)
|
GrizzlyFuture<DataFrame> |
send(byte[] data)
Send a text frame |
GrizzlyFuture<DataFrame> |
send(String data)
Send a text frame |
GrizzlyFuture<DataFrame> |
sendPing(byte[] data)
Sends a ping frame with the specified payload (if any). |
GrizzlyFuture<DataFrame> |
sendPong(byte[] data)
Sends a ping frame with the specified payload (if any). |
GrizzlyFuture<DataFrame> |
stream(boolean last,
byte[] fragment,
int off,
int len)
|
GrizzlyFuture<DataFrame> |
stream(boolean last,
String fragment)
|
| Field Detail |
|---|
static final int NORMAL_CLOSURE
static final int END_POINT_GOING_DOWN
static final int PROTOCOL_ERROR
static final int INVALID_DATA
static final int MESSAGE_TOO_LARGE
static final int NO_STATUS_CODE
static final int ABNORMAL_CLOSE
| Method Detail |
|---|
GrizzlyFuture<DataFrame> send(String data)
GrizzlyFuture, which could be used to control the sending completion state.GrizzlyFuture<DataFrame> send(byte[] data)
GrizzlyFuture, which could be used to control the sending completion state.GrizzlyFuture<DataFrame> sendPing(byte[] data)
ping frame with the specified payload (if any).
data - optional payload. Note that payload length is restricted
to 125 bytes or less.
GrizzlyFuture, which could be used to control the sending completion state.GrizzlyFuture<DataFrame> sendPong(byte[] data)
Sends a ping frame with the specified payload (if any).
It may seem odd to send a pong frame, however, RFC-6455 states:
"A Pong frame MAY be sent unsolicited. This serves as a unidirectional heartbeat. A response to an unsolicited Pong frame is not expected."
data - optional payload. Note that payload length is restricted
to 125 bytes or less.
GrizzlyFuture, which could be used to control the sending completion state.
GrizzlyFuture<DataFrame> stream(boolean last,
String fragment)
GrizzlyFuture<DataFrame> stream(boolean last,
byte[] fragment,
int off,
int len)
void close()
void close(int code)
void close(int code,
String reason)
boolean isConnected()
void onConnect()
void onMessage(String text)
void onMessage(byte[] data)
void onFragment(boolean last,
String payload)
void onFragment(boolean last,
byte[] payload)
void onClose(DataFrame frame)
void onPing(DataFrame frame)
void onPong(DataFrame frame)
boolean add(WebSocketListener listener)
boolean remove(WebSocketListener listener)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||