File tree Expand file tree Collapse file tree 6 files changed +53
-23
lines changed
examples/web-socket-server Expand file tree Collapse file tree 6 files changed +53
-23
lines changed Original file line number Diff line number Diff line change 1
- # web-socket-server
1
+ # web-socket-server (sockjs)
2
2
3
3
To create a custom server implementation.
4
4
@@ -23,27 +23,6 @@ Usage via CLI:
23
23
npx webpack serve --web-socket-server sockjs --open
24
24
```
25
25
26
- ## ws
27
-
28
- This mode uses [ ws] ( https://github.com/websockets/ws ) as a server.
29
-
30
- ** webpack.config.js**
31
-
32
- ``` js
33
- module .exports = {
34
- // ...
35
- devServer: {
36
- webSocketServer: " ws" ,
37
- },
38
- };
39
- ```
40
-
41
- Usage via CLI:
42
-
43
- ``` console
44
- npx webpack serve --web-socket-server ws --open
45
- ```
46
-
47
26
### What Should Happen
48
27
49
28
1 . The script should open ` http://localhost:8080/ ` in your default browser.
File renamed without changes.
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
+ devServer : {
11
+ webSocketServer : "sockjs" ,
12
+ } ,
13
+ } ) ;
Original file line number Diff line number Diff line change
1
+ # web-socket-server (ws)
2
+
3
+ To create a custom server implementation.
4
+
5
+ ## ws
6
+
7
+ This mode uses [ ws] ( https://github.com/websockets/ws ) as a server.
8
+
9
+ ** webpack.config.js**
10
+
11
+ ``` js
12
+ module .exports = {
13
+ // ...
14
+ devServer: {
15
+ webSocketServer: " ws" ,
16
+ },
17
+ };
18
+ ```
19
+
20
+ Usage via CLI:
21
+
22
+ ``` console
23
+ npx webpack serve --web-socket-server ws --open
24
+ ```
25
+
26
+ ### What Should Happen
27
+
28
+ 1 . The script should open ` http://localhost:8080/ ` in your default browser.
29
+ 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 2
2
3
3
// our setup function adds behind-the-scenes bits to the config that all of our
4
4
// examples need
5
- const { setup } = require ( "../util" ) ;
5
+ const { setup } = require ( "../../ util" ) ;
6
6
7
7
module . exports = setup ( {
8
8
context : __dirname ,
9
9
entry : "./app.js" ,
10
+ devServer : {
11
+ webSocketServer : "ws" ,
12
+ } ,
10
13
} ) ;
You can’t perform that action at this time.
0 commit comments