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:
  • transports (list or str) – Passed verbatim to autobahn.asyncio.component.Component as transports.
  • realm (str) – WAMP realm. Passed verbatim to autobahn.asyncio.component.Component as realm.
  • client (modbusclient.asyncio.ApiWrapper) – An implementation of an API wrapper.
component

autobahn.asyncio.component.Component – Autobahn WAMP component wrapped by this class

session

autobahn.wamp.protocol.ApplicationSession – Session passed during on_join. None if 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. None if client is currently not joined to any session.
Return type:autobahn.wamp.protocol.ApplicationSession
warning(msg, **kwargs)[source]

Create warning level log message

Parameters:
  • msg (str) – Log message.
  • **kwargs – Keyword arguments passed to message formatter