pyrtma.client.client_context
- client_context(module_id=0, server_name='localhost:7111', msg_list=None, host_id=0, timecode=False, logger_status=False, allow_multiple=False, name='')[source]
Context manager function to simplify initializing a pyrtma Client
Context manager will yield a Client object after connecting to message manager, optionally subscribing to msg_list, and after calling send_module_ready(). Client will disconnect when exiting context.
- Parameters:
module_id (
int) – Static module ID, which must be unique. Defaults to 0, which generates a dynamic module ID.server_name (
str) – IP_addr:port_num string associated with message manager. Defaults to “localhost:7111”.msg_list (
Iterable[int] |None) – A list of numeric message IDs to subscribe tohost_id (
int) – Host ID. Defaults to 0.timecode (
bool) – Add additional timecode fields to message header, used by some projects at RNEL. Defaults to False.logger_status (
bool) – Flag to declare client as a logger module. Logger modules are automatically subscribed to all message types. Defaults to False.allow_multiple (
bool) – Flag to declare client can have multiple instances. Defaults to False.name (
str) – Name of module
- Yields:
Client – initialized pyrtma Client object