Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was having a hard time integrating this into a project where I need to send messages over socket.io, but couldn't allow WebSocket to take over execution of my process, So I extended your classes into a threaded version that can be more easily integrated into my existing code, I'm not sure if you think this is useful but I thought I'd send it your way just in case.
I'm relatively new to Python, and it could be that this is unnecessary and I'm just using your code wrong, but this "WorksForMe™", I'm mildly concerned about thread safety and haven't yet bothered to do much testing, I think the biggest concern would be in user code when a new .on(...) is called before a previous one has finished, in that case I think it's up to the end user to appropriately use locks & semaphors I guess.
The only bug I'm currently experiencing is a long timeout (about 5 seconds) if stop is called after some messages have been sent, before the thread actually terminates
Below is an example of how I'm using it.