@@ -77,6 +77,12 @@ Features
77
77
successfully or unsuccessfully executed commands, with built-in Prometheus
78
78
and logging backends.
79
79
80
+ - Connection maintenance
81
+
82
+ SocketShark supports keeping the WebSocket connection alive and automatic
83
+ discovery of its closure through automated server-side pings and handlers
84
+ for client-side pings.
85
+
80
86
.. _websockets : https://websockets.readthedocs.io/
81
87
82
88
Quick start
@@ -105,6 +111,7 @@ supports the following events:
105
111
- ``subscribe ``: Subscribe to a topic
106
112
- ``message ``: Send a message to a topic
107
113
- ``unsubscribe ``: Unsubscribe from a topic
114
+ - ``ping ``: Monitor connectivity
108
115
109
116
Responses usually contain a ``status `` field which can be ``ok `` or ``error ``.
110
117
In case of an error, an ``error `` field is supplied containing the error
@@ -296,6 +303,28 @@ Example server responses (successful and unsuccessful):
296
303
"error" : " Subscription does not exist."
297
304
}
298
305
306
+ Ping
307
+ ~~~~
308
+
309
+ Clients can send a ``ping `` message and Socketshark will send a ``pong `` back
310
+ immediately, without contacting any services. Clients may choose to send pings
311
+ and monitor for pongs to e.g. detect failed WebSocket connections, display
312
+ latency metrics, etc. Furthermore, the ping message may contain some ``data ``,
313
+ which the pong message should repeat back.
314
+
315
+ Example client request:
316
+
317
+ .. code :: json
318
+
319
+ {"event" : " ping" , "data" : " foobar" }
320
+
321
+ Example server response:
322
+
323
+ .. code :: json
324
+
325
+ {"event" : " pong" , "data" : " foobar" }
326
+
327
+
299
328
Service Protocol
300
329
================
301
330
0 commit comments