WAMP Client¶
In order to use an asynchronous Modbus Client as WAMP component, there exists a thin wrapper around the API baseclass, which turns the API implementation into a WAMP component. The wrapper uses the Autobahn WAMP framework, which allows to integrate seamlessly with the crossbar.io router, which supports WAMP and MQTT environments out of the box.
Base Class for WAMP Components¶
-
class
modbusclient.asyncio.autobahn.ComponentBase(transports, realm, client)[source]¶ A base class for WAMP components
This class provides a template to turn an asynchronous Modbus client into a WAMP client using the Autobahn package. Provided you have an API client derived from
modbusclient.asyncio.ApiWrapper, you can use this class as base class for your WAMP client and provice the API client as client argument. This avoids the repetition of some boiler plate code.Parameters: -
component¶ autobahn.asyncio.component.Component– Autobahn WAMP component wrapped by this class
-
session¶ autobahn.wamp.protocol.ApplicationSession– Session passed during on_join.Noneif client has not joined any session.
-
component Get component wrapped by this instance
Returns: Autobahn WAMP component wrapped by this class Return type: autobahn.asyncio.component.Component
-
debug(msg, **kwargs)[source]¶ Create debug level log message
Parameters: - msg (str) – Log message.
- **kwargs – Keyword arguments passed to message formatter
-
error(msg, **kwargs)[source]¶ Create error level log message
Parameters: - msg (str) – Log message.
- **kwargs – Keyword arguments passed to message formatter
-
info(msg, **kwargs)[source]¶ Create info level log message
Parameters: - msg (str) – Log message.
- **kwargs – Keyword arguments passed to message formatter
-
session Get currently joined session
Returns: - Session passed
- during on_join.
Noneif client is currently not joined to any session.
Return type: autobahn.wamp.protocol.ApplicationSession
-