Skip to content

Commit 9094965

Browse files
committed
Adjust README.md to include error frame handler and health check method details
1 parent 255542b commit 9094965

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ async with stompman.Client(
2424
stompman.ConnectionParameters(host="172.0.0.1", port=61616, login="user2", passcode="passcode2"),
2525
],
2626

27-
# Handlers:
28-
on_error_frame=lambda error_frame: print(error_frame.body),
29-
on_heartbeat=lambda: print("Server sent a heartbeat"), # also can be async
3027

3128
# SSL — can be either `None` (default), `True`, or `ssl.SSLContext'
3229
ssl=None,
3330

31+
# Error frame handler:
32+
on_error_frame=lambda error_frame: print(error_frame.body),
33+
3434
# Optional parameters with sensible defaults:
3535
heartbeat=stompman.Heartbeat(will_send_interval_ms=1000, want_to_receive_interval_ms=1000),
3636
connect_retry_attempts=3,
@@ -40,6 +40,7 @@ async with stompman.Client(
4040
disconnect_confirmation_timeout=2,
4141
read_timeout=2,
4242
write_retry_attempts=3,
43+
check_server_alive_interval_factor=3,
4344
) as client:
4445
...
4546
```
@@ -131,6 +132,7 @@ stompman takes care of cleaning up resources automatically. When you leave the c
131132
- If multiple servers were provided, stompman will attempt to connect to each one simultaneously and will use the first that succeeds. If all servers fail to connect, an `stompman.FailedAllConnectAttemptsError` will be raised. In normal situation it doesn't need to be handled: tune retry and timeout parameters in `stompman.Client()` to your needs.
132133

133134
- When connection is lost, stompman will attempt to handle it automatically. `stompman.FailedAllConnectAttemptsError` will be raised if all connection attempts fail. `stompman.FailedAllWriteAttemptsError` will be raised if connection succeeds but sending a frame or heartbeat lead to losing connection.
135+
- To implement health checks, use `stompman.Client.is_alive()` — it will return `True` if everything is OK and `False` if server is not responding.
134136

135137
### ...and caveats
136138

0 commit comments

Comments
 (0)