org.eclipse.jetty.websocket
Interface WebSocket.FrameConnection

All Superinterfaces:
WebSocket.Connection
All Known Implementing Classes:
WebSocketConnectionD00, WebSocketServletConnectionD00
Enclosing interface:
WebSocket

public static interface WebSocket.FrameConnection
extends WebSocket.Connection

Frame Level Connection

The Connection interface at the level of sending/receiving frames rather than messages. Also contains methods to decode/generate flags and opcodes without using constants, so that code can be written to work with multiple drafts of the protocol.


Method Summary
 byte binaryOpcode()
           
 byte continuationOpcode()
           
 byte finMask()
           
 boolean isAllowFrameFragmentation()
           
 boolean isBinary(byte opcode)
           
 boolean isClose(byte opcode)
           
 boolean isContinuation(byte opcode)
           
 boolean isControl(byte opcode)
           
 boolean isMessageComplete(byte flags)
           
 boolean isPing(byte opcode)
           
 boolean isPong(byte opcode)
           
 boolean isText(byte opcode)
           
 void sendControl(byte control, byte[] data, int offset, int length)
          Send a control frame
 void sendFrame(byte flags, byte opcode, byte[] data, int offset, int length)
          Send an arbitrary frame
 void setAllowFrameFragmentation(boolean allowFragmentation)
          Set if frames larger than the frame buffer are handled with local fragmentations
 byte textOpcode()
           
 
Methods inherited from interface org.eclipse.jetty.websocket.WebSocket.Connection
close, close, disconnect, getMaxBinaryMessageSize, getMaxIdleTime, getMaxTextMessageSize, getProtocol, isOpen, sendMessage, sendMessage, setMaxBinaryMessageSize, setMaxIdleTime, setMaxTextMessageSize
 

Method Detail

binaryOpcode

byte binaryOpcode()
Returns:
The opcode of a binary message

textOpcode

byte textOpcode()
Returns:
The opcode of a text message

continuationOpcode

byte continuationOpcode()
Returns:
The opcode of a continuation frame

finMask

byte finMask()
Returns:
Mask for the FIN bit.

setAllowFrameFragmentation

void setAllowFrameFragmentation(boolean allowFragmentation)
Set if frames larger than the frame buffer are handled with local fragmentations

Parameters:
allowFragmentation -

isMessageComplete

boolean isMessageComplete(byte flags)
Parameters:
flags - The flags bytes of a frame
Returns:
True of the flags indicate a final frame.

isControl

boolean isControl(byte opcode)
Parameters:
opcode -
Returns:
True if the opcode is for a control frame

isText

boolean isText(byte opcode)
Parameters:
opcode -
Returns:
True if the opcode is for a text frame

isBinary

boolean isBinary(byte opcode)
Parameters:
opcode -
Returns:
True if the opcode is for a binary frame

isContinuation

boolean isContinuation(byte opcode)
Parameters:
opcode -
Returns:
True if the opcode is for a continuation frame

isClose

boolean isClose(byte opcode)
Parameters:
opcode -
Returns:
True if the opcode is a close control

isPing

boolean isPing(byte opcode)
Parameters:
opcode -
Returns:
True if the opcode is a ping control

isPong

boolean isPong(byte opcode)
Parameters:
opcode -
Returns:
True if the opcode is a pong control

isAllowFrameFragmentation

boolean isAllowFrameFragmentation()
Returns:
True if frames larger than the frame buffer are fragmented.

sendControl

void sendControl(byte control,
                 byte[] data,
                 int offset,
                 int length)
                 throws IOException
Send a control frame

Parameters:
control -
data -
offset -
length -
Throws:
IOException

sendFrame

void sendFrame(byte flags,
               byte opcode,
               byte[] data,
               int offset,
               int length)
               throws IOException
Send an arbitrary frame

Parameters:
flags -
opcode -
data -
offset -
length -
Throws:
IOException


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