Help, disconnecting Python client


Hi, I’m doing something that’s ‘new’ for me and I seem to be hitting an issue I can’t seem to address …

I’m dynamically creating a WAMP client, running it, then having it terminate the connection to the server. The problem is, however I disconnect I get an error telling me;

"dropping connection to peer tcp4: with abort=True; websocket closing handshake timeout (server did not drop TCP connection in time)"

I’ve I just call “leave”, the connection doesn’t actually, terminate, and if I call “disconnect”, I get the above error.

Can anyone point me in the right direction?

(Crossbar 17.2.1, autobahn 0.17.2, Python 3.5.2)

class Phantom(ApplicationSession):

def onConnect(self):

    """When we connect to the router."""

    print("> Connect")

    self.join('crossbar', ['wampcra'], 'guest', authrole=u'server')

def onDisconnect(self):

    """When we disconnect from the router."""

    print("> Disconnect")

def onJoin(self, details):

    print("> Join")
    self.leave('wamp.close.normal', 'session complete')

def onLeave(self, details):

    print("> Leave")


class Start(object):
def init(self, context):
component_config = ComponentConfig(realm=context.conf.realm, extra=context)
self.factory = ApplicationSessionFactory(config=component_config)
self.factory.session = Phantom
url = “%s://%s:%s/ws” % (‘wss’, ‘localhost’, 8443)
transport = WampWebSocketClientFactory(self.factory, url)
class CtxFactory(ssl.ClientContextFactory):
def getContext(self):
self.method = SSLv23_METHOD
ctx = ssl.ClientContextFactory.getContext(self)
return ctx
ctx = CtxFactory()
connectWS(transport, ctx)