I've spent some time trawling through stack overflow and google, but alas I was unable to find the what I've been looking for (there may be something I've missed, sorry if there is). This is driving me insane as I'm so certain it all looks right, but obviously something is wrong and I just can't see it.
Basically, the handshake is fine. I receive and parse packets from the client fine.
When I try to send framed packet data back to the client, the client does nothing (not even an error). I've tried it on the latest Firefox and Chrome browsers using the example on echo.websocket.org and my own written javascript object. I can see the packet being sent and received via Wireshark on both the client and the server.
Here is an example of what I'm sending and a breakdown of the packet according to the RFC 6455 standards.
Entire Response Packet Sent :
00 16 d3 65 d0 50 f4 6d
04 00 5f 84 08 00 45 00
00 32 5f e3 40 00 80 06
17 8c c0 a8 01 02 c0 a8
01 04 1f 91 05 18 fd 56
6f 03 ea 17 6d 4c 50 18
01 00 c0 fa 00 00 81 84
b2 3f de 11 83 0d ed 25
Payload Data Unmasked Should Read : 1234
Data :
81 84 B2 3F DE 11 83 0D ED 25
FIN, RSV 1-3 and Op Code :
0x81 1000 0001
FIN 1
RSV1 0
RSV2 0
RSV3 0
Opcode 1
Mask and Payload Length :
0x84 1000 0100
Mask 1
Length 4
Mask Key :
0xB2 1011 0010
0x3F 0011 1111
0xDE 1101 1110
0x11 0001 0001
Masked Payload Data :
0x83 1000 0011
0x0D 0000 1101
0xED 1110 1101
0x25 0010 0101
Unmasked Data
Binary Decimal Hex UTF-8
1011 0010
1000 0011 ^
-----------
0011 0001 49 31 1
0011 1111
0000 1101 ^
-----------
0011 0010 50 32 2
1101 1110
1110 1101 ^
-----------
0011 0011 51 33 3
0001 0001
0010 0101 ^
-----------
0011 0100 52 34 4
My entire codebase is on GitHub, but here are the core files :
Data Frame Structure : https://github.com/willitscale/simplejavawebsocket/blob/master/java/src/uk/co/n3tw0rk/websocketregistration/framing/DataFrame.java
Data Frame Response Builder : https://github.com/willitscale/simplejavawebsocket/blob/master/java/src/uk/co/n3tw0rk/websocketregistration/framing/DataFrameResponse.java
Client Socket Connection Thread : https://github.com/willitscale/simplejavawebsocket/blob/master/java/src/uk/co/n3tw0rk/websocketregistration/threads/SocketClient.java
Whole repository : https://github.com/willitscale/simplejavawebsocket
Any help would be much appreciated!