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).
Before this change, the websocket messages sent were saved masked, and the text cannot be read.
1234567891011121314151617181920212223242526272829303132Stat Connected.Sent 24/02/2021 10:59:01: GET / HTTP/1.1Host: echo.websocket.orgUpgrade: websocketConnection: UpgradeSec-WebSocket-Key: hKokOwscWkDOF6Y3liZ2yA==Origin: echo.websocket.orgSec-WebSocket-Version: 13Recv 24/02/2021 10:59:01: HTTP/1.1 101 Web Socket Protocol HandshakeAccess-Control-Allow-Credentials: trueAccess-Control-Allow-Headers: content-typeAccess-Control-Allow-Headers: authorizationAccess-Control-Allow-Headers: x-websocket-extensionsAccess-Control-Allow-Headers: x-websocket-versionAccess-Control-Allow-Headers: x-websocket-protocolAccess-Control-Allow-Origin: echo.websocket.orgConnection: UpgradeDate: Wed, 24 Feb 2021 09:56:07 GMTSec-WebSocket-Accept: pgtoE2wbo/G1uvjCN/CX7N6OltE=Server: Kaazing GatewayUpgrade: websocketSent 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.
Find below the log, where the messages sent are not masked.
1234567891011121314151617181920212223242526272829303132Stat Connected.Sent 24/02/2021 11:00:16: GET / HTTP/1.1Host: echo.websocket.orgUpgrade: websocketConnection: UpgradeSec-WebSocket-Key: wSZGb+0KEUZacGDFcz47gg==Origin: echo.websocket.orgSec-WebSocket-Version: 13Recv 24/02/2021 11:00:16: HTTP/1.1 101 Web Socket Protocol HandshakeAccess-Control-Allow-Credentials: trueAccess-Control-Allow-Headers: content-typeAccess-Control-Allow-Headers: authorizationAccess-Control-Allow-Headers: x-websocket-extensionsAccess-Control-Allow-Headers: x-websocket-versionAccess-Control-Allow-Headers: x-websocket-protocolAccess-Control-Allow-Origin: echo.websocket.orgConnection: UpgradeDate: Wed, 24 Feb 2021 09:57:22 GMTSec-WebSocket-Accept: WtGNEtct4WtQ5SAs/PWmvjspj6c=Server: Kaazing GatewayUpgrade: websocketSent 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.
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.