PythonPusherClient icon indicating copy to clipboard operation
PythonPusherClient copied to clipboard

Added arguments in the callback with bind

Open bartbroere opened this issue 8 years ago • 3 comments

This is useful for pusher messages that include variables in the name of the message (or the channel for that matter), instead of in the data. When setting the callback, some keyword arguments can be provided that should be supplied with each message. In my codebase this change prevented that I have to do one of the following:

  • have lots of functions with repeating code,
  • write wrapper functions,
  • define lots of functions with lambdas in for loops.

In an ideal world this change would not be necessary, but in a lot of practical use cases, it is nice to have it. Furthermore, this change is nearly completely backwards compatible, unless an implementation uses the variables in the spawned instance directly.

bartbroere avatar Sep 16 '16 10:09 bartbroere

@ekulyk Would you consider merging these changes? Thanks in advance.

bartbroere avatar Sep 16 '16 15:09 bartbroere

If these changes are not merged, I will probably make my own version of PythonPusherClient, and upload it to Pypi, because a project I plan to release will be dependent on the changes made here.

bartbroere avatar Sep 21 '16 20:09 bartbroere

@ekulyk this is a very usful feature. Is it gonna be merged?

illera88 avatar Nov 25 '17 16:11 illera88