PythonPusherClient
PythonPusherClient copied to clipboard
Added arguments in the callback with bind
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.
@ekulyk Would you consider merging these changes? Thanks in advance.
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.
@ekulyk this is a very usful feature. Is it gonna be merged?