autobahn.py websocket automatic reconect?

88 views
Skip to first unread message

Dennis Xiloj

unread,
Jun 19, 2014, 7:39:14 PM6/19/14
to autob...@googlegroups.com
Hi!

I'd just discovered crossbar and wamp, it seems very cool and i tink i will use it a lot in my python projects.


I have benn testing the demos and the examples, and there is something i miss when working with a python frontend: the autobahn.js implementation keeps trying to reconnect after a connection lost. With python i have no idea how to acomplish the same thing.

Does someone have an example of this?

Thanks!
- Dennis.

Tobias Oberstein

unread,
Jun 20, 2014, 9:58:49 AM6/20/14
to autob...@googlegroups.com
Am 20.06.2014 01:39, schrieb Dennis Xiloj:
> Hi!
>
> I'd just discovered crossbar and wamp, it seems very cool and i tink i
> will use it a lot in my python projects.

Great! Please keep us updated on what you do / progress!

>
>
> I have benn testing the demos and the examples, and there is something i
> miss when working with a python frontend: the autobahn.js implementation
> keeps trying to reconnect after a connection lost. With python i have no
> idea how to acomplish the same thing.
>
> Does someone have an example of this?

With Autobahn/Twisted, the "recommended" way of making clients
automatically reconnect is by mixing in Twisted ReconnectingClientFactory:

https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_variants/client_reconnecting.py

http://twistedmatrix.com/documents/current/api/twisted.internet.protocol.ReconnectingClientFactory.html

Hope this helps,
/Tobias


>
> Thanks!
> - Dennis.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autobahnws+...@googlegroups.com
> <mailto:autobahnws+...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Dennis Xiloj

unread,
Jun 21, 2014, 4:20:28 AM6/21/14
to autob...@googlegroups.com


El viernes, 20 de junio de 2014 07:58:49 UTC-6, Tobias Oberstein escribió:
Am 20.06.2014 01:39, schrieb Dennis Xiloj:
> Hi!
>
> I'd just discovered crossbar and wamp, it seems very cool and i tink i
> will use it a lot in my python projects.

Great! Please keep us updated on what you do / progress! 

Shure! 
 
>
>
> I have benn testing the demos and the examples, and there is something i
> miss when working with a python frontend: the autobahn.js implementation
> keeps trying to reconnect after a connection lost. With python i have no
> idea how to acomplish the same thing.
>
> Does someone have an example of this?

With Autobahn/Twisted, the "recommended" way of making clients
automatically reconnect is by mixing in Twisted ReconnectingClientFactory:

https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_variants/client_reconnecting.py

http://twistedmatrix.com/documents/current/api/twisted.internet.protocol.ReconnectingClientFactory.html

Hope this helps,
/Tobias

So with WAMP it should be like this... right?


Thanks for your help!
-Dennis

Tobias Oberstein

unread,
Jun 21, 2014, 3:04:55 PM6/21/14
to autob...@googlegroups.com
> So with WAMP it should be like this... right?
> https://gist.github.com/DenJohX/e6d0864738da10cb9685

Yep, that's the idea.

/Tobias

Mike Panetta

unread,
Sep 22, 2014, 8:38:07 PM9/22/14
to autob...@googlegroups.com
Does this still work with Autobahn 0.9.x?  I am trying to do something similar to this but my clientConnection{Lost,Failed} never get called.

I can provide code if needed. 

Thanks,
Mike

Mike Panetta

unread,
Sep 23, 2014, 11:39:06 AM9/23/14
to autob...@googlegroups.com
Ok, got it working...  I was using the wrong connect method.  I tried being smart and thought reproducing what was in ApplicationRunner would work...

Thanks,
Mike

Tobias Oberstein

unread,
Oct 8, 2014, 5:18:08 PM10/8/14
to autob...@googlegroups.com
Am 23.09.2014 02:38, schrieb Mike Panetta:
>
>
> On Saturday, June 21, 2014 3:04:55 PM UTC-4, Tobias Oberstein wrote:
>
> > So with WAMP it should be like this... right?
> > https://gist.github.com/DenJohX/e6d0864738da10cb9685
> <https://gist.github.com/DenJohX/e6d0864738da10cb9685>
>
> Yep, that's the idea.
>
> /Tobias
>
>
> Does this still work with Autobahn 0.9.x? I am trying to do something
> similar to this but my clientConnection{Lost,Failed} never get called.

Hi Mike,

I've added a complete example (works for me):

https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/reconnecting

Cheers,
/Tobias


>
> I can provide code if needed.
>
> Thanks,
> Mike
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autobahnws+...@googlegroups.com
> <mailto:autobahnws+...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autobahnws/04090f13-4172-4b85-a6ba-66d665273748%40googlegroups.com
> <https://groups.google.com/d/msgid/autobahnws/04090f13-4172-4b85-a6ba-66d665273748%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages