Possible to create PWA with livewire?

Good day folks,
I’m starting to move toward Livewire for a couple of projects but it’s yet to find any documentation or guide about PWA with livewire. is it possible? can you guys recommend any guide?

1 Like

I’ve been wondering the same thing! I think it can be done and am considering testing the idea out sometime soon.

For offline purposes you would want to use the cache API and cache all the requests that livewire makes. I’m not sure how well this would work with wire:loading but it should be fine.

You would also want to use a service worker to save the assets.

Another thing that maybe useful is client side url updating via the history API.

//SomeComponent.php
$this->emit('urlChange', 'https://someurl.local/category/somecategory?test');
Listen for the event.

//some-component.blade.php
@push('footer-scripts')
    <script type="text/javascript">
        document.addEventListener('livewire:available', function () {
            window.livewire.on('urlChange', param => {
                history.pushState(null, null, param);
            })
        })
    </script>
@endpush