Asyncio reconnect does not work

36 views
Skip to first unread message

sebastiaan...@wegroup.be

unread,
Oct 4, 2018, 4:36:34 AM10/4/18
to Crossbar
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
Reply all
Reply to author
Forward
0 new messages