Skip to content

Commit d10bcc3

Browse files
authored
docs: update web-socket-url example (#3678)
1 parent c9271b9 commit d10bcc3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

examples/web-socket-url/README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
module.exports = {
77
// ...
88
devServer: {
9+
host: "0.0.0.0",
910
client: {
10-
webSocketURL: "ws://localhost:8080",
11+
webSocketURL: "ws://<insert-host>:8080",
1112
},
1213
},
1314
};
@@ -16,9 +17,16 @@ module.exports = {
1617
Usage via CLI:
1718

1819
```console
19-
npx webpack serve
20+
npx webpack serve --open --host 0.0.0.0 --client-web-socket-url ws://<insert-host>:8080
2021
```
2122

23+
_NOTE: replace `<insert-host>` with your local IP Address._
24+
25+
In order to make the server publicly accessible the client needs to know with
26+
what host to connect to the server. If `--host 0.0.0.0` is given, the client
27+
would try to connect to `0.0.0.0`. With the `--client-web-socket-url` and related options it is possible to
28+
override this.
29+
2230
You're now able to explicitly define the protocol used with the `client.webSocketURL` option
2331
(have a look at the config provided in `webpack.config.js`).
2432

0 commit comments

Comments
 (0)