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 GitHub
parent eadee3a2e2
commit 5a1fbf37c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -206,21 +206,32 @@ Triggers
``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
api:
# ...
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:
``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