From 2d39c56e3d7db44e5a0a2fe1ac0d8c64c4ba71de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Thu, 20 Feb 2025 17:28:07 +0100 Subject: [PATCH] updates docs --- docs/user-guide/interaction/Python Client.md | 7 +++++-- src/pydase/client/client.py | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/user-guide/interaction/Python Client.md b/docs/user-guide/interaction/Python Client.md index 2878ce4..34e575f 100644 --- a/docs/user-guide/interaction/Python Client.md +++ b/docs/user-guide/interaction/Python Client.md @@ -50,12 +50,14 @@ import pydase class MyService(pydase.DataService): proxy = pydase.Client( url="ws://:", - block_until_connected=False + block_until_connected=False, + client_id="my_pydase_client_id", ).proxy # For SSL-encrypted services, use the wss protocol # proxy = pydase.Client( # url="wss://your-domain.ch", - # block_until_connected=False + # block_until_connected=False, + # client_id="my_pydase_client_id", # ).proxy if __name__ == "__main__": @@ -67,6 +69,7 @@ if __name__ == "__main__": In this example: - The `MyService` class has a `proxy` attribute that connects to a `pydase` service at `:`. - By setting `block_until_connected=False`, the service can start without waiting for the connection to succeed, which is particularly useful in distributed systems where services may initialize in any order. +- By setting `client_id`, the server will provide more accurate logs of the connecting client. If set, this ID is sent as `X-Client-Id` header in the HTTP(s) request. ## Custom `socketio.AsyncClient` Connection Parameters diff --git a/src/pydase/client/client.py b/src/pydase/client/client.py index 59d23d0..c429331 100644 --- a/src/pydase/client/client.py +++ b/src/pydase/client/client.py @@ -56,6 +56,9 @@ class Client: [`AsyncClient`][socketio.AsyncClient]. This allows fine-tuning of the client's behaviour (e.g., reconnection attempts or reconnection delay). Default is an empty dictionary. + client_id: Client identification that will be shown in the server logs this + client is connecting to. This ID is passed as a `X-Client-Id` header in the + HTTP(s) request. Defaults to None. Example: The following example demonstrates a `Client` instance that connects to another