public class WebSocketConnectionD00 extends AbstractConnection implements WebSocketConnection, WebSocket.FrameConnection
| Modifier and Type | Field and Description |
|---|---|
static byte |
LENGTH_FRAME |
static byte |
SENTINEL_FRAME |
_endp| Constructor and Description |
|---|
WebSocketConnectionD00(WebSocket websocket,
EndPoint endpoint,
WebSocketBuffers buffers,
long timestamp,
int maxIdleTime,
java.lang.String protocol) |
| Modifier and Type | Method and Description |
|---|---|
byte |
binaryOpcode() |
void |
close()
Close the connection with normal close code.
|
void |
close(int code,
java.lang.String message)
Close the connection with specific closeCode and message.
|
byte |
continuationOpcode() |
void |
disconnect() |
static byte[] |
doTheHixieHixieShake(long key1,
long key2,
byte[] key3) |
void |
fillBuffersFrom(Buffer buffer) |
byte |
finMask() |
WebSocket.Connection |
getConnection() |
java.util.List<Extension> |
getExtensions() |
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
|
java.lang.String |
getProtocol() |
Connection |
handle()
Handle the connection.
|
boolean |
isAllowFrameFragmentation() |
boolean |
isBinary(byte opcode) |
boolean |
isClose(byte opcode) |
boolean |
isContinuation(byte opcode) |
boolean |
isControl(byte opcode) |
boolean |
isIdle() |
boolean |
isMessageComplete(byte flags) |
boolean |
isMore(byte flags) |
boolean |
isOpen() |
boolean |
isPing(byte opcode) |
boolean |
isPong(byte opcode) |
boolean |
isSuspended()
The semantic of this method is to return true to indicate interest in further reads,
or false otherwise, but it is misnamed and should be really called
isReadInterested(). |
boolean |
isText(byte opcode) |
void |
onClose()
Called after the connection is closed
|
protected void |
onFrameHandshake() |
void |
onInputShutdown() |
protected void |
onWebsocketOpen() |
void |
sendControl(byte code,
byte[] content,
int offset,
int length)
Send a control frame
|
void |
sendFrame(byte flags,
byte opcode,
byte[] content,
int offset,
int length)
Send an arbitrary frame
|
void |
sendMessage(byte[] data,
int offset,
int length) |
void |
sendMessage(java.lang.String content) |
void |
setAllowFrameFragmentation(boolean allowFragmentation)
Set if frames larger than the frame buffer are handled with local fragmentations
|
void |
setHixieKeys(java.lang.String key1,
java.lang.String key2) |
void |
setMaxBinaryMessageSize(int size) |
void |
setMaxIdleTime(int ms) |
void |
setMaxTextMessageSize(int size) |
void |
shutdown() |
byte |
textOpcode() |
getEndPoint, getTimeStamp, onIdleExpired, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetTimeStamp, onIdleExpiredpublic static final byte LENGTH_FRAME
public static final byte SENTINEL_FRAME
public WebSocketConnectionD00(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, java.lang.String protocol) throws java.io.IOException
java.io.IOExceptionpublic WebSocket.Connection getConnection()
getConnection in interface WebSocketConnectionpublic void setHixieKeys(java.lang.String key1,
java.lang.String key2)
public Connection handle() throws java.io.IOException
Connectionhandle in interface Connectionjava.io.IOException - if the handling of I/O operations failpublic void onInputShutdown()
throws java.io.IOException
onInputShutdown in interface AsyncConnectionjava.io.IOExceptionpublic boolean isOpen()
isOpen in interface WebSocket.Connectionpublic boolean isIdle()
isIdle in interface ConnectionConnection.onIdleExpired(long)public boolean isSuspended()
ConnectionThe semantic of this method is to return true to indicate interest in further reads,
or false otherwise, but it is misnamed and should be really called isReadInterested().
isSuspended in interface Connectionpublic void onClose()
ConnectiononClose in interface Connectionpublic void sendMessage(java.lang.String content)
throws java.io.IOException
sendMessage in interface WebSocket.Connectionjava.io.IOExceptionpublic void sendMessage(byte[] data,
int offset,
int length)
throws java.io.IOException
sendMessage in interface WebSocket.Connectionjava.io.IOExceptionpublic boolean isMore(byte flags)
public void sendControl(byte code,
byte[] content,
int offset,
int length)
throws java.io.IOException
sendControl in interface WebSocket.FrameConnectionjava.io.IOExceptionpublic void sendFrame(byte flags,
byte opcode,
byte[] content,
int offset,
int length)
throws java.io.IOException
WebSocket.FrameConnectionsendFrame in interface WebSocket.FrameConnectionjava.io.IOExceptionpublic void close(int code,
java.lang.String message)
WebSocket.Connectionclose in interface WebSocket.Connectioncode - The close code to send, or -1 for no close codemessage - The message to send or null for no messagepublic void disconnect()
disconnect in interface WebSocket.Connectionpublic void close()
WebSocket.Connectionclose in interface WebSocket.Connectionpublic void shutdown()
shutdown in interface WebSocketConnectionpublic void fillBuffersFrom(Buffer buffer)
fillBuffersFrom in interface WebSocketConnectionpublic static byte[] doTheHixieHixieShake(long key1,
long key2,
byte[] key3)
public void setMaxTextMessageSize(int size)
setMaxTextMessageSize in interface WebSocket.Connectionsize - size<0 No aggregation of frames to messages, >=0 max size of text frame aggregation buffer in characterspublic void setMaxIdleTime(int ms)
setMaxIdleTime in interface WebSocket.Connectionms - The time in ms that the connection can be idle before closingpublic void setMaxBinaryMessageSize(int size)
setMaxBinaryMessageSize in interface WebSocket.Connectionsize - size<0 no aggregation of binary frames, >=0 size of binary frame aggregation bufferpublic int getMaxTextMessageSize()
WebSocket.ConnectiongetMaxTextMessageSize in interface WebSocket.Connectionpublic int getMaxIdleTime()
getMaxIdleTime in interface WebSocket.Connectionpublic int getMaxBinaryMessageSize()
WebSocket.ConnectiongetMaxBinaryMessageSize in interface WebSocket.Connectionpublic java.lang.String getProtocol()
getProtocol in interface WebSocket.Connectionprotected void onFrameHandshake()
protected void onWebsocketOpen()
public boolean isMessageComplete(byte flags)
isMessageComplete in interface WebSocket.FrameConnectionflags - The flags bytes of a framepublic byte binaryOpcode()
binaryOpcode in interface WebSocket.FrameConnectionpublic byte textOpcode()
textOpcode in interface WebSocket.FrameConnectionpublic boolean isControl(byte opcode)
isControl in interface WebSocket.FrameConnectionpublic boolean isText(byte opcode)
isText in interface WebSocket.FrameConnectionpublic boolean isBinary(byte opcode)
isBinary in interface WebSocket.FrameConnectionpublic boolean isContinuation(byte opcode)
isContinuation in interface WebSocket.FrameConnectionpublic boolean isClose(byte opcode)
isClose in interface WebSocket.FrameConnectionpublic boolean isPing(byte opcode)
isPing in interface WebSocket.FrameConnectionpublic boolean isPong(byte opcode)
isPong in interface WebSocket.FrameConnectionpublic java.util.List<Extension> getExtensions()
getExtensions in interface WebSocketConnectionpublic byte continuationOpcode()
continuationOpcode in interface WebSocket.FrameConnectionpublic byte finMask()
finMask in interface WebSocket.FrameConnectionpublic void setAllowFrameFragmentation(boolean allowFragmentation)
WebSocket.FrameConnectionsetAllowFrameFragmentation in interface WebSocket.FrameConnectionpublic boolean isAllowFrameFragmentation()
isAllowFrameFragmentation in interface WebSocket.FrameConnectionCopyright © 2013 FuseSource, Corp.. All Rights Reserved.