WebSocket Masked Messages

From sgcWebSockets 4.4.8 the Log of websocket messages has been improved. Till now, the messages were saved as was sent/received by socket, this means that when a websocket message was sent by websocket client, this was first masked and then saved to log. As the message was masked, it can't be read easily so the log was useless for the websocket messages sent by client (the same for websocket messages received by server).

Now the websocket frames are saved UnMasked by default (this can be customized accessing to property LogFile.UnMaskFrames). So when client sends a message, it will be saved unmasked and when server receives a websocket message, it will be save unmasked too (in the case of the server, it will be saved masked and unmasked, because server can handle several protocols and when the buffer is read it doesn't knows which is the protocol).

WebSocket Client Masked Messages 

Before this change, the websocket messages sent were saved masked, and the text cannot be read.

Stat Connected.
Sent 24/02/2021 10:59:01: GET / HTTP/1.1
Host: echo.websocket.org
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: hKokOwscWkDOF6Y3liZ2yA==
Origin: echo.websocket.org
Sec-WebSocket-Version: 13


Recv 24/02/2021 10:59:01: HTTP/1.1 101 Web Socket Protocol Handshake
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: content-type
Access-Control-Allow-Headers: authorization
Access-Control-Allow-Headers: x-websocket-extensions
Access-Control-Allow-Headers: x-websocket-version
Access-Control-Allow-Headers: x-websocket-protocol
Access-Control-Allow-Origin: echo.websocket.org
Connection: Upgrade
Date: Wed, 24 Feb 2021 09:56:07 GMT
Sec-WebSocket-Accept: pgtoE2wbo/G1uvjCN/CX7N6OltE=
Server: Kaazing Gateway
Upgrade: websocket


Sent 24/02/2021 10:59:07: œoŽ´'zâØ ?èÆ r®Ç|ÙÑ
Lá×zúÇN>¯•
Recv 24/02/2021 10:59:07: Hello from sgcWebSockets!!!!
Stat Disconnected.
Stat Disconnected.
Stat Disconnected. 

 WebSocket Client UnMasked Messages

Find below the log, where the messages sent are not masked.

Stat Connected.
Sent 24/02/2021 11:00:16: GET / HTTP/1.1
Host: echo.websocket.org
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: wSZGb+0KEUZacGDFcz47gg==
Origin: echo.websocket.org
Sec-WebSocket-Version: 13


Recv 24/02/2021 11:00:16: HTTP/1.1 101 Web Socket Protocol Handshake
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: content-type
Access-Control-Allow-Headers: authorization
Access-Control-Allow-Headers: x-websocket-extensions
Access-Control-Allow-Headers: x-websocket-version
Access-Control-Allow-Headers: x-websocket-protocol
Access-Control-Allow-Origin: echo.websocket.org
Connection: Upgrade
Date: Wed, 24 Feb 2021 09:57:22 GMT
Sec-WebSocket-Accept: WtGNEtct4WtQ5SAs/PWmvjspj6c=
Server: Kaazing Gateway
Upgrade: websocket


Sent 24/02/2021 11:00:21: [text] Hello from sgcWebSockets!!!!
Recv 24/02/2021 11:00:21: Hello from sgcWebSockets!!!!
Stat Disconnected.
Stat Disconnected.
Stat Disconnected.
 
×
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

Coinbase Pro REST API
sgcWebSockets 4.4.7

Related Posts