S
Solara17mo ago
Tao

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)
2 Replies
mariobuikhuizen
mariobuikhuizen17mo 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
MaartenBreddels17mo ago
That’s optional btw
Want results from more Discord servers?
Add your server