You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
./configure (...) --add-dynamic-module=./ngx_http_websocket_stat_module && make modules
14
+
./configure (...) --add-dynamic-module=./src/ngx_http_websocket_stat_module && make modules
15
15
```
16
-
2. Build nginx with make -j<n> command where n is number of cpu cores on your build machine
17
-
18
-
Alternatively could be used build script shipped along with module:
19
-
From module directory run
20
-
```sh
21
-
test/build_helper.py build
22
-
```
23
-
It would download and build nginx and all required libraries (openssl, pcre and zlib) and generate nginx configuration file.
24
16
25
17
## Usage
26
18
27
19
To enable websocket frames logging specify `log_enabled on` and `ws_log_format` in server section of nginx config file. Additionally, specify `ws_log` to override the log file, which is used to log ws frames.
28
20
29
21
To customize connection open and close log messages use "open" and "close" parameter for ws_log_format directive.
30
-
To log only when the full message is received/sent use "message" parameter for ws_log_format directive.
31
-
32
-
Maximum number of concurrent websocket connections could be specified with ws_max_connections on server section. This value applies to whole connections that are on nginx. Argument should be integer representing maximum connections. When client tries to open more connections it recevies close framee with 1013 error code and connection is closed on nginx side. If zero number of connections is given there would be no limit on websocket connections.
22
+
To log only when the full message is received/sent use "server"/"client" parameters for ws_log_format directive.
33
23
34
24
To set maximum single connection lifetime use ws_conn_age parameter. Argument is time given in nginx time format (e.g. 1s, 1m 1h and so on). When connection's lifetime is exceeding specified value there is close websocket packet with 4001 error code generated and connection is closed.
35
25
36
-
37
26
Here is a list of variables you can use in log format string:
38
27
39
28
* $ws_opcode - websocket packet opcode. Look into https://tools.ietf.org/html/rfc6455 Section 5.2, Base Framing Protocol.
@@ -52,22 +41,7 @@ Here is a list of variables you can use in log format string:
52
41
* $server_port - Server's port
53
42
* $upstream_addr - websocket backend address
54
43
55
-
## Example of configuration
56
-
57
-
```
58
-
59
-
server
60
-
{
61
-
ws_log <path/to/logfile>;
62
-
ws_log_format "$time_local: packet of type $ws_opcode received from $ws_packet_source, packet size is $ws_payload_size";
63
-
ws_log_format open "$time_local: Connection opened";
64
-
ws_log_format close "$time_local: Connection closed";
65
-
ws_max_connections 200;
66
-
ws_conn_age 12h;
67
-
...
68
-
}
69
-
70
-
```
44
+
See [nginx sample configuraion](docker/nginx.conf).
echo "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?" \
0 commit comments