WebSocket message size is 2B larger in Firefox than in Chrome
Categories
(DevTools :: Netmonitor, defect)
Tracking
(Not tracked)
People
(Reporter: fvsch, Unassigned)
References
(Blocks 1 open bug)
Details
Mentioned on GitHub:
https://github.com/firefox-devtools/ux/issues/71#issuecomment-511235380
For a Websocket message of "Hello"
, Chrome shows the message's length as 5 bytes, and currently the WS pane in Netmonitor shows it as 7 bytes.
It looks like the length is computed in the UI component (netmonitor/src/components/websockets/FrameListColumnSize.js
) which receives the string \"Hello\"
.
Should we fix it, or are the quotes part of the message in the WebSockets protocol maybe?
Another thing to consider maybe, since we're showing bytes: using String.prototype.length like we currently do will produce wrong results. WS uses UTF-8, and the byte length of é
is 2, while "é".length === 1
.
A fix could be:
const encoder = new TextEncoder();
encoder.encode("é").byteLength; // 2
Comment 1•5 years ago
|
||
Hi Florens
Thanks for pointing this out :) I've observed this too and will be fixing this as part of the work done for another bug. It's a small change so I won't be separating out the patches.
Comment 2•5 years ago
|
||
Thanks for the report Florens!
This will be fixed as part of bug 1555634
Honza
Updated•5 years ago
|
Description
•