org.eclipse.jetty.websocket
Interface WebSocket.Connection

All Known Subinterfaces:
WebSocket.FrameConnection
All Known Implementing Classes:
WebSocketConnectionD00, WebSocketServletConnectionD00
Enclosing interface:
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.


Method Summary
 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)
           
 

Method Detail

getProtocol

String getProtocol()

sendMessage

void sendMessage(String data)
                 throws IOException
Throws:
IOException

sendMessage

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

disconnect

void disconnect()
Deprecated. 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.

Parameters:
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)
Parameters:
ms - The time in ms that the connection can be idle before closing

setMaxTextMessageSize

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

setMaxBinaryMessageSize

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

getMaxIdleTime

int getMaxIdleTime()
Returns:
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

Returns:
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

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


Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.