MCPcopy Index your code
hub / github.com/nodejs/node / close

Method close

deps/undici/undici.js:15978–15990  ·  view source on GitHub ↗

* @see https://websockets.spec.whatwg.org/#dom-websocket-close * @param {number|undefined} code * @param {string|undefined} reason

(code = void 0, reason = void 0)

Source from the content-addressed store, hash-verified

15976 * @param {string|undefined} reason
15977 */
15978 close(code = void 0, reason = void 0) {
15979 webidl.brandCheck(this, _WebSocket);
15980 const prefix = "WebSocket.close";
15981 if (code !== void 0) {
15982 code = webidl.converters["unsigned short"](code, prefix, "code", webidl.attributes.Clamp);
15983 }
15984 if (reason !== void 0) {
15985 reason = webidl.converters.USVString(reason);
15986 }
15987 code ??= null;
15988 reason ??= "";
15989 closeWebSocketConnection(this.#handler, code, reason, true);
15990 }
15991 /**
15992 * @see https://websockets.spec.whatwg.org/#dom-websocket-send
15993 * @param {NodeJS.TypedArray|ArrayBuffer|Blob|string} data

Callers

nothing calls this directly

Calls 3

brandCheckMethod · 0.80
USVStringMethod · 0.80
closeWebSocketConnectionFunction · 0.70

Tested by

no test coverage detected