PdCom5 Process

class pdcom5.Process(appname: str = '')

PdCom Process.

Parameters

appname – Name of this application, default “”.

async activeMessages() → list[Message]

Get a list of active messages.

Active messages are messages which haven’t been resetted yet.

async broadcast(message: str, attr: str = 'text')

Send a broadcast message to all clients.

Parameters
  • message – Message

  • attr – type of the message, default ‘text’

close()

Close the connection.

async connect(url: str, ssl_ctx: Optional[ssl.SSLContext] = None)

Create a connection.

Parameters
  • url – URL of the server, format msr[s]://user:password@server.port

  • ssl_ctx – Optional SSLContext instance for secure communication.

Raises
create_subscriber(transmission: pdcom5._PdComWrapper.Transmission) → pdcom5.Subscription.Subscriber

Create a Subscriber instance.

async find(path: str) → Optional[pdcom5.Variable.Variable]

Find a Variable.

Parameters

path – Path of the Variable

Returns

None (if Variable not found) or Variable

async getClientStatistics() → List[pdcom5._PdComWrapper.ClientStatistics]

Get statistics about all connected clients.

async getMessage(id: int) → Optional[pdcom5._PdComWrapper.Message]

Get a specific message.

Parameters

id – Number of the Message.

async getVariableValue(var: Union[pdcom5.Variable.Variable, str])

Get the current value of a variable.

Parameters

var – Variable or its path.

async list(path: str = '') → pdcom5.Process.ListReply

List all Variables and directories.

Parameters

path – Path of a directory, defaults to “”.

async login(user, password)

Login to a server.

Parameters
  • user – Username

  • password – Password

Raises
  • ValueError – PdCom was built without SASL support.

  • LoginFailed – Login has failed.

async logout()

Logout and clear credentials.

property name

Name of the server application.

async ping(timeout: float = None)

ping the server.

async pollMessage() → pdcom5._PdComWrapper.Message

Wait for a new Event to happen/for a message to be sent.

Deprecated since version 5.3.

This function is deprecated, please use streamMessages() instead.

async setVariableValue(var: Union[pdcom5.Variable.Variable, str], value)

Set a variable to a given value.

Parameters
  • var – Variable or its path.

  • value – Desired value.

streamBroadcasts() → AsyncGenerator[pdcom5.Process.BroadcastMessage, Any]

Stream Broadcasts.

New in version 5.3.

Use with an async for loop.

streamMessages() → AsyncGenerator[pdcom5._PdComWrapper.Message, Any]

Stream Events/Messages.

New in version 5.3.

Use with an async for loop.

async subscribe(transmission: pdcom5._PdComWrapper.Transmission, variable: Union[str, pdcom5.Variable.Variable], selector: Optional[pdcom5._PdComWrapper.Selector] = None) → pdcom5.Subscription.SubscriptionWithSubscriber

Subscribe to a Variable.

There are three options to access the value of the Subscription:
  • Access the value property at any time.

  • Wait for the next incoming value using read().

  • Iterate over all incoming values with an async for loop using newValues().

Parameters
  • transmission – Transmission mode, can also be a float (=period in seconds) or timedelta instance.

  • variable – The Variable to subscribe to, or its path.

  • selector – Optional selector to create a view on multidimensional data.

property version

Version of the server application