mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-20 00:10:03 +02:00
updates Readme with client instructions
This commit is contained in:
parent
1ac08bf97d
commit
348ff092aa
@ -170,7 +170,8 @@ import pydase
|
|||||||
|
|
||||||
# Replace the hostname and port with the IP address and the port of the machine where
|
# Replace the hostname and port with the IP address and the port of the machine where
|
||||||
# the service is running, respectively
|
# the service is running, respectively
|
||||||
client_proxy = pydase.Client(hostname="<ip_addr>", port=8001).proxy
|
client_proxy = pydase.Client(url="ws://<ip_addr>:<service_port>").proxy
|
||||||
|
# client_proxy = pydase.Client(url="wss://your-domain.ch").proxy # if your service uses ssl-encryption
|
||||||
|
|
||||||
# After the connection, interact with the service attributes as if they were local
|
# After the connection, interact with the service attributes as if they were local
|
||||||
client_proxy.voltage = 5.0
|
client_proxy.voltage = 5.0
|
||||||
@ -195,7 +196,8 @@ import pydase
|
|||||||
|
|
||||||
class MyService(pydase.DataService):
|
class MyService(pydase.DataService):
|
||||||
# Initialize the client without blocking the constructor
|
# Initialize the client without blocking the constructor
|
||||||
proxy = pydase.Client(hostname="<ip_addr>", port=8001, block_until_connected=False).proxy
|
proxy = pydase.Client(url="ws://<ip_addr>:<service_port>", block_until_connected=False).proxy
|
||||||
|
# proxy = pydase.Client(url="wss://your-domain.ch", block_until_connected=False).proxy # communicating with ssl-encrypted service
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
service = MyService()
|
service = MyService()
|
||||||
|
@ -5,9 +5,10 @@ You can connect to the service using the `pydase.Client`. Below is an example of
|
|||||||
```python
|
```python
|
||||||
import pydase
|
import pydase
|
||||||
|
|
||||||
# Replace the hostname and port with the IP address and the port of the machine
|
# Replace the hostname and port with the IP address and the port of the machine where
|
||||||
# where the service is running, respectively
|
# the service is running, respectively
|
||||||
client_proxy = pydase.Client(hostname="<ip_addr>", port=8001).proxy
|
client_proxy = pydase.Client(url="ws://<ip_addr>:<service_port>").proxy
|
||||||
|
# client_proxy = pydase.Client(url="wss://your-domain.ch").proxy # if your service uses ssl-encryption
|
||||||
|
|
||||||
# Interact with the service attributes as if they were local
|
# Interact with the service attributes as if they were local
|
||||||
client_proxy.voltage = 5.0
|
client_proxy.voltage = 5.0
|
||||||
@ -32,7 +33,8 @@ import pydase
|
|||||||
|
|
||||||
class MyService(pydase.DataService):
|
class MyService(pydase.DataService):
|
||||||
# Initialize the client without blocking the constructor
|
# Initialize the client without blocking the constructor
|
||||||
proxy = pydase.Client(hostname="<ip_addr>", port=8001, block_until_connected=False).proxy
|
proxy = pydase.Client(url="ws://<ip_addr>:<service_port>", block_until_connected=False).proxy
|
||||||
|
# proxy = pydase.Client(url="wss://your-domain.ch", block_until_connected=False).proxy # communicating with ssl-encrypted service
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
service = MyService()
|
service = MyService()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user