Description
A bit surprising, this is not about #14. I don't care about "proper" implementation of ping/pong but am having problems because the ws server (which is beyond my control) sends a ping on connect and the client on my side reads 1 byte too many and the frames on my side got royally screwed up from there on.
The problem is around here: https://github.com/lipp/lua-websockets/blob/master/src/websocket/sync.lua#L14
The first chunk read apparently is always of size 3 - but it turns out PING is a frame of only 2 bytes.
On example i tracked with wireshark, the first chunk read is "89 00 82", which gets returned to me as an empty message (which is fine by me) - however turns out the PING is actually "89 00" and the 82 is part of the next frame "82 0b ..." (11 byte binary frame). Because 82 was mis-read, the 2nd frame turns into "0b ..." and everything goes downhill afterwards.
Seems that simply changing that line to bytes = 2
might be okay, given a quick skim at frame.decode() - but is that so?
ps. also bytes = 2
on line 60