[Twisted-Python] stop/start client connections with loseConnection in ReconnectingClientFactory

Tobias Oberstein tobias.oberstein at gmail.com
Tue Apr 2 01:25:17 MDT 2019


Am 02.04.19 um 09:03 schrieb Chris Withers:
> On 02/04/2019 07:56, Tobias Oberstein wrote:
>>> Would be good to get that converted...
>>
>> yeah, agreed.
>>
>> unlikely to happen though (lack of time) unless someone steps up with 
>> a PR
> 
> Okay, but then don't be surprised when people get tripped up by it...

well, I never claimed to be surprised. I was only triggered by the 
reference to our _docs_ as we've put quite some work improving on that.

but honestly, lets not further drum that line;) it leads nowhere. I am 
with you: there is room for improvements. if you have a PR, please think 
about contributing! we'll be working with you / merging ..

> 
>>> What's the simplest way to connect a ClientService to a websocket url 
>>> (ie: ws://host/endpoint or wss://host/endpoint)
>>
>> you might adapt / start from this (again WAMP, but just a matter of 
>> using websocket rather than wamp factories/protocols):
>>
>> https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/wamp/basic/client_using_clientservice.py 
> 
> 
> Any way to get rid of the ugly duplication between the url in line 69 
> and the endpoint on line 72?
> 
> I seem to remember that ends up happening with or without ClientService.

I am aware, but no, it's designed like this, because WebSocket requires 
a HTTP URL (with potentially path components, query parameters etc) in 
the opening handshake while the _transport_ does not necessarily have that.

Autobahn allows you to run WebSocket over basically everything that is a 
bidirectional byte pipe: TCP of course, but also Unix domain socket, 
pipes, Tor onion services (via https://github.com/meejah/txtorcon) and 
even serial ports!

Cheers,
/Tobias

> 
> Chris




More information about the Twisted-Python mailing list