org.eclipse.jetty.websocket
接口 WebSocket.Connection

所有已知子接口:
WebSocket.FrameConnection
所有已知实现类:
WebSocketConnectionD00, WebSocketServletConnectionD00
正在封闭接口:
WebSocket

public static interface WebSocket.Connection

A Connection interface is passed to a WebSocket instance via the 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.


方法摘要
 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()
          已过时。 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)
           
 

方法详细信息

getProtocol

String getProtocol()

sendMessage

void sendMessage(String data)
                 throws IOException
抛出:
IOException

sendMessage

void sendMessage(byte[] data,
                 int offset,
                 int length)
                 throws IOException
抛出:
IOException

disconnect

void disconnect()
已过时。 Use close()


close

void close()
Close the connection with normal close code.


close

void close(int closeCode,
           String message)
Close the connection with specific closeCode and message.

参数:
closeCode - The close code to send, or -1 for no close code
message - The message to send or null for no message

isOpen

boolean isOpen()

setMaxIdleTime

void setMaxIdleTime(int ms)
参数:
ms - The time in ms that the connection can be idle before closing

setMaxTextMessageSize

void setMaxTextMessageSize(int size)
参数:
size - size<0 No aggregation of frames to messages, >=0 max size of text frame aggregation buffer in characters

setMaxBinaryMessageSize

void setMaxBinaryMessageSize(int size)
参数:
size - size<0 no aggregation of binary frames, >=0 size of binary frame aggregation buffer

getMaxIdleTime

int getMaxIdleTime()
返回:
The time in ms that the connection can be idle before closing

getMaxTextMessageSize

int getMaxTextMessageSize()
Size in characters of the maximum text message to be received

返回:
size <0 No aggregation of frames to messages, >=0 max size of text frame aggregation buffer in characters

getMaxBinaryMessageSize

int getMaxBinaryMessageSize()
Size in bytes of the maximum binary message to be received

返回:
size <0 no aggregation of binary frames, >=0 size of binary frame aggregation buffer


Copyright © 2013. All Rights Reserved.