Fix broken WS message queue and clean up code
Fix broken WS message queue and clean up code

The previous “queued” implementation never used the global variable for
anything; it was always reset to the latest msg.data contents on
function entry. Thus there was no such thing as “return; // wait for
more data” since it would all be overwritten on the next function call.

Moreover, web sockets always send full messages as a single entity and
are never broken-up into pieces, so there was never any need to
reconstruct anything.

There was also a needless use of a “serverMessage” variable which was
instantly copied into “queued”, which just leads to memory bloat; if we
want access to the original message at any point we can simply use
“msg.data” instead of keeping that extra variable around.

Therefore, the code was restructured to use a “mfcMessageQueue”
variable which gets gradually shrunken down as all the MFC message
contents are extracted from the current web socket message.

The commented-out newline stripping was also removed completely, since
it is a bad idea and would always interfere with the payload length
check.

Comments were added to make the entire message parsing process more
obvious.

KradekMFC/MFCSocket,KradekMFC/MFCSocket