libwebsockets/READMEs/README.lws_conmon.md
Andy Green c3d8423d38 conmon: make part of client build
Let's lose LWS_WITH_CONMON, because we're going to mutate it into a built-in
feature for WITH_CLIENT as part of Happy Eyeballs work.

This should be a NOP for LWS_WITH_CONMON users since all the related
functionality is no longer conditional but always built in for WITH_CLIENT.
2022-05-16 16:49:34 +01:00

1.3 KiB

lws_conmon apis

lws_conmon apis for user code... add some staticistic and other information to client connections that can use useful for devices to introspect how the connection to their servers is actually performing.

The public apis can be found in libwebsockets/lws-conmon.h.

A struct is provided that describes

  • the peer sockaddr the wsi actually connected to, if any

  • a deep copy of the aggregate DNS results (struct addrinfo list) that the client had access to for the peer

  • the number of us dns lookup took

  • the number of us the socket connection took

  • the number of us the tls link establishment took

  • the number of us from the transaction request to the first response, if the protocol has a transaction concept

Because the user code may want to hold on to the DNS list for longer than the life of the wsi that originated it, the lws_conmon_wsi_take() api allows the ownership of the allocated list to be transferred to the user code (as well as copying data out into the user's struct so it no longer has any dependency on wsi lifetime either). The DNS list copy in the struct must be released at some point by calling lws_conmon_release(), but that can be at any time afterwards.

The lws-minimal-http-client example shows how user code can use the apis, run it with --conmon to get a dump of the collected information.