public static interface WebSocket.Connection
WebSocket.onOpen(Connection)
to
give the application access to the specifics of the current connection. This includes methods
for sending frames and messages as well as methods for interpreting the flags and opcodes of the connection.Modifier and Type | Method and Description |
---|---|
void |
close()
Close the connection with normal close code.
|
void |
close(int closeCode,
String message)
Close the connection with specific closeCode and message.
|
void |
disconnect()
Deprecated.
Use
close() |
int |
getMaxBinaryMessageSize()
Size in bytes of the maximum binary message to be received
|
int |
getMaxIdleTime() |
int |
getMaxTextMessageSize()
Size in characters of the maximum text message to be received
|
String |
getProtocol() |
boolean |
isOpen() |
void |
sendMessage(byte[] data,
int offset,
int length) |
void |
sendMessage(String data) |
void |
setMaxBinaryMessageSize(int size) |
void |
setMaxIdleTime(int ms) |
void |
setMaxTextMessageSize(int size) |
String getProtocol()
void sendMessage(String data) throws IOException
IOException
void sendMessage(byte[] data, int offset, int length) throws IOException
IOException
void disconnect()
close()
void close()
void close(int closeCode, String message)
closeCode
- The close code to send, or -1 for no close codemessage
- The message to send or null for no messageboolean isOpen()
void setMaxIdleTime(int ms)
ms
- The time in ms that the connection can be idle before closingvoid setMaxTextMessageSize(int size)
size
- size<0 No aggregation of frames to messages, >=0 max size of text frame aggregation buffer in charactersvoid setMaxBinaryMessageSize(int size)
size
- size<0 no aggregation of binary frames, >=0 size of binary frame aggregation bufferint getMaxIdleTime()
int getMaxTextMessageSize()
int getMaxBinaryMessageSize()
Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.