public class WebSocketProtocolAbstraction extends Object
Web socket protocol packet specification (see: http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-03):
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-------+-+-------------+-------------------------------+ |M|R|R|R| opcode|R| Payload len | Extended payload length | |O|S|S|S| (4) |S| (7) | (16/63) | |R|V|V|V| |V| | (if payload len==126/127) | |E|1|2|3| |4| | | +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - + | Extended payload length continued, if payload len == 127 | + - - - - - - - - - - - - - - - +-------------------------------+ | | Extension data | +-------------------------------+ - - - - - - - - - - - - - - - + : : +---------------------------------------------------------------+ : Application data : +---------------------------------------------------------------+
| Constructor and Description |
|---|
WebSocketProtocolAbstraction() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
calcCloseData(int aReasonCode,
String aReasonString) |
static byte[] |
calcClosePayload(int aReasonCode,
byte[] aReason) |
static WebSocketFrameType |
encodingToFrameType(WebSocketEncoding aEncoding) |
static int |
frameTypeToOpcode(int aVersion,
WebSocketFrameType aFrameType) |
static boolean |
isHixieDraft(String aDraft) |
static boolean |
isHixieVersion(int aVersion) |
static boolean |
isHybiDraft(String aDraft) |
static boolean |
isHybiVersion(int aVersion) |
static boolean |
isValidDraft(String aDraft) |
static boolean |
isValidVersion(int aVersion) |
static WebSocketFrameType |
opcodeToFrameType(int aVersion,
int aOpcode)
converts a WebSocket protocol opcode to an abstract jWebSocket frame type
|
static WebSocketPacket |
protocolToRawPacket(int aVersion,
InputStream aIS) |
static byte[] |
rawToProtocolPacket(int aVersion,
WebSocketPacket aDataPacket)
converts an abstract data packet into a protocol specific frame according
to the correct version.
|
static int |
read(InputStream aIS) |
static List<byte[]> |
toProtocolPacketFragmented(WebSocketPacket aSrc,
int aFragmentSize) |
public static boolean isHixieVersion(int aVersion)
aVersion - public static boolean isHybiVersion(int aVersion)
aVersion - public static boolean isValidVersion(int aVersion)
aVersion - public static boolean isHixieDraft(String aDraft)
aDraft - public static boolean isHybiDraft(String aDraft)
aDraft - public static boolean isValidDraft(String aDraft)
aDraft - public static byte[] calcClosePayload(int aReasonCode,
byte[] aReason)
public static byte[] calcCloseData(int aReasonCode,
String aReasonString)
public static byte[] rawToProtocolPacket(int aVersion,
WebSocketPacket aDataPacket)
aVersion - aDataPacket - public static int read(InputStream aIS) throws Exception
Exceptionpublic static WebSocketPacket protocolToRawPacket(int aVersion, InputStream aIS) throws Exception
aVersion - aIS - Exceptionpublic static List<byte[]> toProtocolPacketFragmented(WebSocketPacket aSrc, int aFragmentSize)
aSrc - aFragmentSize - public static WebSocketFrameType opcodeToFrameType(int aVersion, int aOpcode)
aVersion - aOpcode - public static int frameTypeToOpcode(int aVersion,
WebSocketFrameType aFrameType)
aVersion - aFrameType - public static WebSocketFrameType encodingToFrameType(WebSocketEncoding aEncoding)
aEncoding - Copyright © 2013. All Rights Reserved.