Skip to content

Commit ca36239

Browse files
authored
docs: add --web-socket-server (#3300)
1 parent 2e8a649 commit ca36239

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# CLI: web-socket-server
2+
3+
To create a custom server implementation.
4+
5+
## sockjs
6+
7+
This mode uses [SockJS-node](https://github.com/sockjs/sockjs-node) as a server.
8+
9+
```console
10+
npx webpack serve --web-socket-server sockjs --open-target
11+
```
12+
13+
## ws
14+
15+
This mode uses [ws](https://github.com/websockets/ws) as a server.
16+
17+
```console
18+
npx webpack serve --web-socket-server ws --open-target
19+
```
20+
21+
### What Should Happen
22+
23+
1. The script should open `http://localhost:8080/` in your default browser.
24+
2. You should see the text on the page itself change to read `Success!`.

examples/cli/web-server-socket/app.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
const target = document.querySelector('#target');
4+
5+
target.classList.add('pass');
6+
target.innerHTML = 'Success!';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
// our setup function adds behind-the-scenes bits to the config that all of our
4+
// examples need
5+
const { setup } = require('../../util');
6+
7+
module.exports = setup({
8+
context: __dirname,
9+
entry: './app.js',
10+
});

0 commit comments

Comments
 (0)