Yep, sounds a bit like you are piling up new clients which each tries to reconnect again and again.
Probably instead of implementing a reconnection policy yourself (yes, we are guilty of that also), we should use
The "problem" is, Autobahn (currently) defines
class WebSocketClientFactory(protocol.ClientFactory, WebSocketFactory):
A Twisted factory for WebSocket client protocols.
protocol = WebSocketClientProtocol
Am 20.06.2013 16:35, schrieb Kevin Campion:
I am trying to get Autobahn.Python to work with disconnecting when
server down, without having to restart the program. The client program
must try to reconnect every x seconds to the server.
My source code works but when client reconnects, I can see in server's
log multiple connection for the same client. I have an
additional connection per trying reconnection.
I think, it's when I use "connector.connect()"
Probably this works:
class MyFactory(ReconnectingClientFactory, WebSocketClientFactory)
Not sure, cannot test right now.
Possibly, the empty implementation in WebSocketClientFactory.clientConnectionFailed and clientConnectionLost
are "in the way" ..
Anyway, I'd try to either use ReconnectingClientFactory or have a look at the implementation.
I use this discussion and the example on GitHub :
My TesteeClientFactory class looks like this :
protocol = TesteeClientProtocol
def clientConnectionLost(self, connector, reason):
def clientConnectionFailed(self, connector, reason):
print "Connection to %s failed (%s)" % (self.url,
def tryToConnect(self, connector):
var = 1
while var == 1 :
time.sleep( 2 )
newConnection = connector.connect()
if newConnection != None:
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.
For more options, visit https://groups.google.com/groups/opt_out.