Prevent retry in the case of authentication error

Hi there, I have crossbar set up for static authentication and I’m using CRA auth. If I send the wrong authid and key the autobahn client is retrying repeatedly with the same authid even though that doesn’t seem to make sense since it the creds are determined to be wrong. How do I prevent a retry in the case of failed auth? Is this easier to do with dymanic auth? I ask this because eventually I will be using dynamic auth anyway.

Thank you.

I was playing around with this a bit more and I just can’t get it to work. First of all in the connectfailure callback gets called with the component as a parameter. I can’t call component.leave(). The session is in component.session_factory but if I call leave() on that I get an error that it needs a self argument.

So I guess my confusion is on where exactly I should call session.leave() after an authentication failure?


I am going to assume you are using a component and passing it into “run” like so:

component = Component(transports=transports, realm=realm, authentication=auth)

In this case, the component will run until it is stopped. session is different, it is given to you when you make a connection to the crossbar router, so leaving it won’t stop the component from retrying to connect. to stop the component you could use:


Alternatively, you could add max_retries to the transport like this to only try to connect once:

transports = [{
    "type": "websocket",
    "url": "ws://localhost:8080/ws",
    "endpoint": {
        "type": "tcp",
        "host": "localhost",
        "port": 8080
    "max_retries": 0
realm = "realm1"
auth = {
    "wampcra": {
        "authid": "skully",
        "secret": "5678"
component = Component(transports=transports, realm=realm, authentication=auth)

Sorry if I have misunderstood, it’s a bit tricky to make suggestions without seeing the code. Hope that helps :slight_smile: