Polling
You can add a wire:poll annotation to your elements to poll for changes for a set interval. By default, this interval is set to every 2 seconds.
1
<div wire:poll>
2
Current time: #now()#
3
</div>
Copied!
You can append a different interval time to your annotation as well.
1
<div wire:poll.5000ms>
2
Current time: #now()#
3
</div>
Copied!
Polling for changes over AJAX is lightweight and is often a good alternative to strategies such as Pusher or WebSockets.

Invoking Method

If you would like to invoke a method during each poll interval, you can do so by specifying a method name.
1
<div wire:poll="checkIfCoffeeIsReady">
2
Current time: #now()#
3
</div>
Copied!
Last modified 2mo ago
Copy link
Edit on GitHub