@@ -113,59 +113,30 @@ For macOS:
113113
114114### Usage
115115
116- All the options are available from the help output, have a look at ` wsstat -h ` :
116+ Some examples :
117117
118- ``` sh
119- wsstat 2.0.0
120- Measure latency on WebSocket connections
121-
122- USAGE:
123- wsstat [options] < url>
124- wsstat -subscribe [options] < url>
125-
126- General:
127- -c, --count < int> number of interactions [default: 1; unlimited when subscribing]
128- --version print program version and exit
129-
130- Input (choose one):
131- --rpc-method < string> JSON-RPC method name to send (with id=1, jsonrpc=2.0)
132- -t, --text < string> text message to send
133-
134- Subscription:
135- -s, --subscribe stream events until interrupted
136- --subscribe-once subscribe and exit after the first event
137- -b, --buffer < int> subscription delivery buffer size in messages [default: 0]
138- --summary-interval < duration>
139- print stat summaries every interval (e.g., 5s, 1m) [default: disabled]
140-
141- Connection:
142- -H, --header < string> HTTP header to include with request (repeatable; format: " Key: Value" )
143- --resolve < string> resolve host:port to specific address (repeatable; format: " HOST:PORT:ADDRESS" )
144- -k, --insecure skip TLS certificate verification (use with caution)
145- --no-tls assume ws:// when URL lacks scheme [default: wss://]
146- --color < string> color output mode: auto, always, never [default: auto]
147-
148- Output:
149- -q, --quiet suppress all output except response
150- -v, --verbose increase verbosity (level 1)
151- -vv increase verbosity (level 2)
152- -f, --format < string> output format: auto, json, raw [default: auto]
153-
154- Verbosity Levels:
155- (default) minimal request info with summary timings
156- -v adds target/TLS summaries and timing diagram
157- -vv includes full TLS certificates and headers
158-
159- Examples:
160- wsstat wss://echo.example.com
161- wsstat -t " ping" wss://echo.example.com
162- wsstat --rpc-method eth_blockNumber wss://rpc.example.com/ws
163- wsstat --subscribe --summary-interval 5s wss://stream.example.com/feed
164- wsstat -H " Authorization: Bearer TOKEN" -H " Origin: https://foo" wss://api.example.com/ws
165- wsstat --resolve example.com:443:127.0.0.1 wss://example.com/ws
166- wsstat --insecure -vv wss://self-signed.example.com
118+ ``` bash
119+ # Basic request
120+ wsstat wss://echo.example.com
121+
122+ # Send an RPC method
123+ wsstat --rpc-method eth_blockNumber wss://rpc.example.com/ws
124+
125+ # Start a subscription
126+ wsstat --subscribe --summary-interval 5s wss://stream.example.com/feed
127+
128+ # Attach headers to dial request
129+ wsstat -H " Authorization: Bearer TOKEN" -H " Origin: https://foo" wss://api.example.com/ws
130+
131+ # Resolve to a target IP and set a longer timeout
132+ wsstat --resolve example.com:443:127.0.0.1 --timeout 30s wss://example.com/ws
133+
134+ # Allow insecure connection, make output extra verbose
135+ wsstat --insecure -vv wss://self-signed.example.com
167136```
168137
138+ For a full list of the available options, check the ` wsstat --help ` option of your client.
139+
169140### Subscription Mode
170141
171142Long-lived streaming endpoints can be exercised with the subscription mode:
@@ -203,7 +174,7 @@ wsstat -subscribe-once -text '{"method":"subscribe_ticker"}' wss://example.org/w
203174
204175For machine-readable output of summaries, add ` -format json ` .
205176
206- # # wsstat Package
177+ ## wsstat Library Package
207178
208179Use the ` wsstat ` Golang package to trace WebSocket connection and latency in your Go applications. It wraps [ gorilla/websocket] ( https://pkg.go.dev/github.com/gorilla/websocket ) for the WebSocket protocol implementation, and measures the duration of the different phases of the connection cycle.
209180
0 commit comments