• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## `lws_conmon` apis
2
3`LWS_WITH_CONMON` build option enables `lws_conmon` apis for user code... these add
4some staticistic and information to client connections that can use useful for devices
5to introspect how the connection to their servers is actually performing.
6
7The public apis can be found in `libwebsockets/lws-conmon.h`.
8
9A struct is provided that describes
10
11 - the peer sockaddr the wsi actually connected to, if any
12
13 - a deep copy of the aggregate DNS results (struct addrinfo list) that the
14   client had access to for the peer
15
16 - the number of us dns lookup took
17
18 - the number of us the socket connection took
19
20 - the number of us the tls link establishment took
21
22 - the number of us from the transaction request to the first response, if
23   the protocol has a transaction concept
24
25Because the user code may want to hold on to the DNS list for longer than the
26life of the wsi that originated it, the `lws_conmon_wsi_take()` api allows
27the ownership of the allocated list to be transferred to the user code (as
28well as copying data out into the user's struct so it no longer has any
29dependency on wsi lifetime either).  The DNS list copy in the struct must be
30released at some point by calling `lws_conmon_release()`, but that
31can be at any time afterwards.
32
33The lws-minimal-http-client example shows how user code can use the apis, build
34lws with the `LWS_WITH_CONMON` cmake option and run with `--conmon` to get a
35dump of the collected information.
36
37