fff
fff

Reputation: 400

Laravel livewire sync between multiple devices (instances)

I have a livewire component called Cart.

If the user open this component in multiple devices at the same time (i.e. mobile and desktop, or open it in multiple browser tabs), and add an item to the cart in the mobile browser, is there a way to refresh the component in desktop browser?

I know these components are independent of each other, so I'm thinking of a solution where I have to store, for example, the component ID (or something like that) and create the another one based on it.

Is there a well-developed solution to this?

Upvotes: 0

Views: 607

Answers (1)

ByWaleed
ByWaleed

Reputation: 402

I'm not aware of any existing solution like this but you could save the cart in DB and then retrieve it for all your platforms. To make it so it's always synced on both platforms you could build your mobile application on APIs or otherwise use something like the Broadcasting within Laravel or a package like Laravel WebSockets.

Livewire is more for building dynamic interfaces removing the complexity of making AJAX requests in the background and doesn't support multiple platforms the way you are wanting.

Upvotes: 1

Related Questions