Module autobahn.wamp.component¶
Component¶
This is common code for both Twisted and asyncio components; see either autobahn.twisted.component.Component or autobahn.asyncio.component.Component for the concrete implementations.
-
class
autobahn.wamp.component.Component(main=None, transports=None, config=None, realm=u'default', extra=None, authentication=None, session_factory=None, is_fatal=None)[source]¶ A WAMP application component. A component holds configuration for (and knows how to create) transports and sessions.
Parameters: - main (callable taking 2 args: reactor, ISession) – After a transport has been connected and a session
has been established and joined to a realm, this (async)
procedure will be run until it finishes – which signals that
the component has run to completion. In this case, it usually
doesn’t make sense to use the
on_*kwargs. If you do not pass a main() procedure, the session will not be closed (unless you arrange for .leave() to be called). - transports (None or unicode or list of dicts) –
Transport configurations for creating transports. Each transport can be a WAMP URL, or a dict containing the following configuration keys:
type(optional):websocket(default) orrawsocketurl: the router URLendpoint(optional, derived from URL if not provided):type: “tcp” or “unix”host,port: only for TCPpath: only for unixtimeout: in secondstls:Trueor (under Twisted) antwisted.internet.ssl.IOpenSSLClientComponentCreatorinstance (such as returned fromtwisted.internet.ssl.optionsForClientTLS) orCertificateOptionsinstance.
- realm (unicode) – the realm to join
- authentication (dict mapping auth_type to dict) – configuration of authenticators
- session_factory (callable) – if None,
ApplicationSessionis used, otherwise a callable taking a singleconfigargument that is used to create a new ApplicationSession instance. - is_fatal (callable taking one arg, or None) – a callable taking a single argument, an
Exceptioninstance. The callable should returnTrueif this error is “fatal”, meaning we should not try connecting to the current transport again. The default behavior (on None) is to always returnFalse
- main (callable taking 2 args: reactor, ISession) – After a transport has been connected and a session
has been established and joined to a realm, this (async)
procedure will be run until it finishes – which signals that
the component has run to completion. In this case, it usually
doesn’t make sense to use the