File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed
examples/cli/web-server-socket Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
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! ` .
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const target = document . querySelector ( '#target' ) ;
4
+
5
+ target . classList . add ( 'pass' ) ;
6
+ target . innerHTML = 'Success!' ;
Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments