3 what s the best way to implement `push

3. what's the best way to implement push notification ? is it something like this ? and is it run as an OS thread or a greenlet in eventloop ? ``` @solara.component def Page(): push_notifications = solara.use_reactive([]) def worker(): // infinite loop while True: // wait for some condition // push_notifications.set(...) solara.use_thread(worker)
mariobuikhuizen
mariobuikhuizen285d ago
Yes, this is the best way to do it if //wait for some condition is not based on Solara reactive vars or component args and you have to wait on the next condition again. Note that the worker function needs an argument: cancel: threading.Event
MaartenBreddels
MaartenBreddels285d ago
That’s optional btw