Closed Bug 1565984 Opened 5 years ago Closed 5 years ago

WebSocket message size is 2B larger in Firefox than in Chrome

Categories

(DevTools :: Netmonitor, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1555634

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

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.

Thanks for the report Florens!

This will be fixed as part of bug 1555634
Honza

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.