MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send
What information was incorrect, unhelpful, or incomplete?
In the Exceptions Thrown section, it says the INVALID_STATE_ERR exception is thrown when send is called while the connection is not OPEN. That is incorrect, as an exception is only called in the CONNECTING state; if CLOSING or CLOSED, send just discards the data. Refer to RFC: https://html.spec.whatwg.org/multipage/web-sockets.html#dom-websocket-send
Or run the following snippet in a browser console:
var ws = new WebSocket("wss://invalid-ws-url.com");
setTimeout(() => ws.send("Hello"), 5000);
Specific section or headline?
Exceptions thrown->INVALID_STATE_ERR
What did you expect to see?
Should say it only throws in the state is CONNECTING. Should probably mention in the description of the method that it doesn't do anything if the connection is already closed, and the onus is on the user to check the readyState before calling send.
Did you test this? If so, how?
Ran a snippet in the browser console:
var ws = new WebSocket("wss://invalid-ws-url.com");
setTimeout(() => ws.send("Hello"), 5000);
MDN Content page report details
MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send
What information was incorrect, unhelpful, or incomplete?
In the Exceptions Thrown section, it says the
INVALID_STATE_ERRexception is thrown whensendis called while the connection is notOPEN. That is incorrect, as an exception is only called in theCONNECTINGstate; ifCLOSINGorCLOSED, send just discards the data. Refer to RFC: https://html.spec.whatwg.org/multipage/web-sockets.html#dom-websocket-sendOr run the following snippet in a browser console:
Specific section or headline?
Exceptions thrown->INVALID_STATE_ERR
What did you expect to see?
Should say it only throws in the state is
CONNECTING. Should probably mention in the description of the method that it doesn't do anything if the connection is already closed, and the onus is on the user to check thereadyStatebefore callingsend.Did you test this? If so, how?
Ran a snippet in the browser console:
MDN Content page report details
en-us/web/api/websocket/send