Help, disconnecting Python client

#1

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:127.0.0.1 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")

    self.disconnect()

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)
ctx.use_certificate_file(‘certificate.pem’)
ctx.use_privatekey_file(‘private_key.pem’)
return ctx
ctx = CtxFactory()
connectWS(transport, ctx)

Start({})

``

0 Likes