How can I end the SSEClient without an event occurring?

Viewed 110

I've been using this SSEClient Python library with the following code:

client = SSEClient(url)
    for event in client:
        func(json.loads(str(event)))

This is being run inside a thread. My problem is that I want to end this thread, but when I was attempting to use stop flags, it would only run when an event had been received (as I assume the iterator is waiting on the next item).

Does anyone have any suggestions on how to end this thread without another event having to occur?

Thank you!

0 Answers
Related