Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on_error function is not called #101

Open
HishamKassar opened this issue Feb 19, 2023 · 0 comments
Open

on_error function is not called #101

HishamKassar opened this issue Feb 19, 2023 · 0 comments

Comments

@HishamKassar
Copy link

Describe the bug
I was trying to get the error when something happened in a handshake or when the server is not reachable, but it seems the function is not working properly

here is my code:

To Reproduce
hub_connection = HubConnectionBuilder()
.with_url(hubUrl,
options={
"access_token_factory": lambda: token,
"skip_negotiation": True,
"verify_ssl": False
})
.configure_logging(logging.DEBUG, socket_trace=False)
.with_automatic_reconnect({
"type": "interval",
"keep_alive_interval": 10,
"intervals": [1, 3, 5, 6, 7, 87, 3]})
.build()

    def on_connection_closed():
        print("connection closed")
        connection_closed = True
        print(connection_closed)
    
    def on_connection_error(data):
        print("An exception was thrown closed")
        print(data)
        callback(False)

    hub_connection.on_close(on_connection_closed)
    hub_connection.on_error(on_connection_error)  

    while True:
        if connection_closed:
            break

Expected behavior
I'm getting all errors on debug level, but I want to get the error from the function on_error and this is not happening. so is there any issue with my previous code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant