Skip to content

Fix callbacks to match the expected number of args#39

Merged
deepbrook merged 1 commit intodeepbrook:masterfrom
squgeim:patch-2
Sep 8, 2018
Merged

Fix callbacks to match the expected number of args#39
deepbrook merged 1 commit intodeepbrook:masterfrom
squgeim:patch-2

Conversation

@squgeim
Copy link
Copy Markdown
Contributor

@squgeim squgeim commented Sep 6, 2018

The callbacks _on_open, _on_message and _on_error provided to WebSocketApp had insufficient number of arguments as expected by websocket-client version 0.51.0 (as mentioned in the requirements.txt).

Fixes #38.

The callbacks _on_open, _on_message and _on_error provided to WebSocketApp had insufficient number of arguments as expected by websocket-clinet version 0.51.0 (as mentioned in the requirements.txt).
@deepbrook
Copy link
Copy Markdown
Owner

Seriously? What are these nuggets doing. Version 0.49.0 removed the ws, now they're adding it back? sigh.
Thanks for picking up on this.

Copy link
Copy Markdown
Owner

@deepbrook deepbrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be on the safe side, please replace the ws parameter with *args.

Comment thread pysher/connection.py
@deepbrook deepbrook merged commit 6e5f8e3 into deepbrook:master Sep 8, 2018
@agronholm
Copy link
Copy Markdown
Contributor

agronholm commented Sep 28, 2018

With the latest Pysher (1.0.3) and the latest websocket-client (0.53.0) I get these errors:

ERROR:websocket:error from callback <bound method Connection._on_open of <Connection(PysherEventLoop, started daemon 140281593100032)>>: _on_open() missing 1 required positional argument: 'ws'
ERROR:websocket:error from callback <bound method Connection._on_message of <Connection(PysherEventLoop, started daemon 140281593100032)>>: _on_message() missing 1 required positional argument: 'message'

Pysher 1.0.1 does not have this problem. I even tried installing websocket-client 0.51.0 to see if it works together with Pysher 1.0.2 but it doesn't. I get the same errors. Comments?

@agronholm
Copy link
Copy Markdown
Contributor

The crux of the problem is that websocket-client treats methods as callbacks differently and does not pass the ws argument. It's a stupid design but it is what it is, so please revert this patch!

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

Successfully merging this pull request may close these issues.

3 participants