Asyncio reconnect does not work

#1

Hi

I am using autobahn python

like this:

from autobahn.wamp.types import ComponentConfig
from autobahn.asyncio.wamp import ApplicationRunner

from config import CROSSBAR_REALM, CROSSBAR_IP

from client import Client

r = ApplicationRunner(CROSSBAR_IP, CROSSBAR_REALM)
session = Client(ComponentConfig(CROSSBAR_REALM, {}))

if name == “main”:

print("Connecting to %s " % (CROSSBAR_IP))

try:

    r.run(session)

except Exception as e:

    print("TRIGGER THIS PLEASE")
    print(e)

``

when I restart crossbar my autobahn service does not reconnect. Do I really need to use twisted instead of asyncio to be able to have a reconnect feature?

I saw this project autobahn_reconnect but can’t use this for python3.7, is there any other way to catch this error and reconnect my autobahn service:

2018-10-04T09:35:09 Exception in callback WebSocketAdapterProtocol.connection_lost(None)
handle: <Handle WebSocketAdapterProtocol.connection_lost(None)>
Traceback (most recent call last):
File “/usr/lib/python3.7/asyncio/events.py”, line 88, in _run
self._context.run(self._callback, *self._args)
File “/home/sevaho/.local/lib/python3.7/site-packages/autobahn/asyncio/websocket.py”, line 100, in connection_lost
self._connectionLost(exc)
File “/home/sevaho/.local/lib/python3.7/site-packages/autobahn/websocket/protocol.py”, line 3363, in _connectionLost
WebSocketProtocol._connectionLost(self, reason)
File “/home/sevaho/.local/lib/python3.7/site-packages/autobahn/websocket/protocol.py”, line 1096, in _connectionLost
reason_string = _maybe_tls_reason(reason.value)
AttributeError: ‘NoneType’ object has no attribute ‘value’

``

Greetings

Sebastiaan

0 Likes