Skip to content

Commit b9bdfc3

Browse files
committed
lib: enable WebSocket by default
1 parent 64c6d97 commit b9bdfc3

File tree

6 files changed

+25
-17
lines changed

6 files changed

+25
-17
lines changed

doc/api/cli.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -931,16 +931,6 @@ added: v12.3.0
931931

932932
Enable experimental WebAssembly module support.
933933

934-
### `--experimental-websocket`
935-
936-
<!-- YAML
937-
added:
938-
- v21.0.0
939-
- v20.10.0
940-
-->
941-
942-
Enable experimental [`WebSocket`][] support.
943-
944934
### `--force-context-aware`
945935

946936
<!-- YAML
@@ -1359,6 +1349,14 @@ added: v16.6.0
13591349

13601350
Use this flag to disable top-level await in REPL.
13611351

1352+
### `--no-experimental-websocket`
1353+
1354+
<!-- YAML
1355+
added: REPLACEME
1356+
-->
1357+
1358+
Use this flag to disable experimental [`WebSocket`][] support.
1359+
13621360
### `--no-extra-info-on-fatal-exception`
13631361

13641362
<!-- YAML
@@ -2493,7 +2491,6 @@ Node.js options that are allowed are:
24932491
* `--experimental-vm-modules`
24942492
* `--experimental-wasi-unstable-preview1`
24952493
* `--experimental-wasm-modules`
2496-
* `--experimental-websocket`
24972494
* `--force-context-aware`
24982495
* `--force-fips`
24992496
* `--force-node-api-uncaught-exceptions-policy`
@@ -2518,6 +2515,7 @@ Node.js options that are allowed are:
25182515
* `--no-experimental-global-navigator`
25192516
* `--no-experimental-global-webcrypto`
25202517
* `--no-experimental-repl-await`
2518+
* `--no-experimental-websocket`
25212519
* `--no-extra-info-on-fatal-exception`
25222520
* `--no-force-async-hooks-checks`
25232521
* `--no-global-search-paths`

doc/api/globals.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1097,12 +1097,16 @@ The object that acts as the namespace for all W3C
10971097
added:
10981098
- v21.0.0
10991099
- v20.10.0
1100+
changes:
1101+
- version: REPLACEME
1102+
pr-url: https://github.com/nodejs/node/pull/51594
1103+
description: No longer behind `--experimental-websocket` CLI flag.
11001104
-->
11011105

11021106
> Stability: 1 - Experimental.
11031107
1104-
A browser-compatible implementation of [`WebSocket`][]. Enable this API
1105-
with the [`--experimental-websocket`][] CLI flag.
1108+
A browser-compatible implementation of [`WebSocket`][]. Disable this API
1109+
with the [`--no-experimental-websocket`][] CLI flag.
11061110

11071111
## Class: `WritableStream`
11081112

@@ -1139,10 +1143,10 @@ A browser-compatible implementation of [`WritableStreamDefaultWriter`][].
11391143
[Navigator API]: https://html.spec.whatwg.org/multipage/system-state.html#the-navigator-object
11401144
[RFC 5646]: https://www.rfc-editor.org/rfc/rfc5646.txt
11411145
[Web Crypto API]: webcrypto.md
1142-
[`--experimental-websocket`]: cli.md#--experimental-websocket
11431146
[`--no-experimental-global-customevent`]: cli.md#--no-experimental-global-customevent
11441147
[`--no-experimental-global-navigator`]: cli.md#--no-experimental-global-navigator
11451148
[`--no-experimental-global-webcrypto`]: cli.md#--no-experimental-global-webcrypto
1149+
[`--no-experimental-websocket`]: cli.md#--no-experimental-websocket
11461150
[`AbortController`]: https://developer.mozilla.org/en-US/docs/Web/API/AbortController
11471151
[`ByteLengthQueuingStrategy`]: webstreams.md#class-bytelengthqueuingstrategy
11481152
[`CompressionStream`]: webstreams.md#class-compressionstream

lib/internal/process/pre_execution.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ function setupUndici() {
349349
});
350350
}
351351

352-
if (getOptionValue('--experimental-websocket')) {
352+
if (!getOptionValue('--no-experimental-websocket')) {
353353
ObjectDefineProperties(globalThis, {
354354
WebSocket: lazyInterface('WebSocket'),
355355
});

src/node_options.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class EnvironmentOptions : public Options {
108108
std::string dns_result_order;
109109
bool enable_source_maps = false;
110110
bool experimental_fetch = true;
111-
bool experimental_websocket = false;
111+
bool experimental_websocket = true;
112112
bool experimental_global_customevent = true;
113113
bool experimental_global_navigator = true;
114114
bool experimental_global_web_crypto = true;
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Flags: --no-experimental-websocket
2+
'use strict';
3+
4+
require('../common');
5+
const assert = require('assert');
6+
7+
assert.strictEqual(typeof WebSocket, 'undefined');

test/parallel/test-websocket.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Flags: --experimental-websocket
21
'use strict';
32

43
require('../common');

0 commit comments

Comments
 (0)