Document variables available to new API triggers (#3309)

* Document variables available to new API triggers

* Copy fix

* Update api.rst

Fixed string type and expanded one of the examples.

---------

Co-authored-by: H. Árkosi Róbert <robreg@zsurob.hu>
This commit is contained in:
Keith Burzinski 2023-10-30 15:03:14 -05:00 committed by Jesse Hills
parent 1927ee00e7
commit 71a21d80b6
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A

View File

@ -206,21 +206,32 @@ Triggers
``on_client_connected`` Trigger ``on_client_connected`` Trigger
******************************* *******************************
This trigger is activated each time a client connects to the API. This trigger is activated each time a client connects to the API. Two variables of
type ``std::string`` are available for use by actions called from within this trigger:
- ``client_address``: the IP address of the client that connected
- ``client_info``: the name of the client that connected
.. code-block:: yaml .. code-block:: yaml
api: api:
# ... # ...
on_client_connected: on_client_connected:
- logger.log: "API client connected!" - logger.log:
format: "Client %s connected to API with IP %s"
args: ["client_info.c_str()", "client_address.c_str()"]
.. _api-on_client_disconnected_trigger: .. _api-on_client_disconnected_trigger:
``on_client_disconnected`` Trigger ``on_client_disconnected`` Trigger
********************************** **********************************
This trigger is activated each time the API disconnects from the API. This trigger is activated each time the API disconnects from the API. Two variables of
type ``std::string`` are available for use by actions called from within this trigger:
- ``client_address``: the IP address of the client that disconnected
- ``client_info``: the name of the client that disconnected
.. code-block:: yaml .. code-block:: yaml