Skip to content

websocket not working as expeced for the latest version: _on_close() takes 2 positional arguments but 4 were given #214

@OuttaSpaceTime

Description

@OuttaSpaceTime

Hey,

I have the following code for my websocket:

    def start_ws(self):
        self.ws = websocket.WebSocketApp(self.wss_url, on_open=self.on_open, on_close=self.on_close,
                                         on_error=self.on_error, on_message=self.on_message)
        self.ws.run_forever()

    def on_open(self, ws):
        logger.info("Binance connection opened")

    def on_close(self, ws):
        logger.warning("Binance connection closed")

    def on_error(self, ws, msg):
        logger.error("Binance connection error: %s", msg)

when I start websocket like so within in my __init__ method:

        threading.Thread(target=self.start_ws).start()

I get the error:

2021-06-21 11:12:18,826 ERROR :: error from callback <bound method Client._on_close of <connectors.client.Client object at 0x0000028C93FDD130>>: _on_close() takes 2 positional arguments but 4 were given

Any idea what is going on here and why is it not working? I also can't see where 4 were given. It only seems be working when I go back version 0.58
How would I have to use it within the latest version?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions