1
votes

We are thrilled about the new IndexDB API and the different overlays that have been created.

One got our attention for it's sync capabilities : CouchDB on the server and PouchDB for the clients.

It should work very well for webApp that should work by themselfs, but in the real life we often need server-side work. A simple example : imagine you want to shoot an email when a user change a book's title.

This is a simplified example but we would use Laravel as our back-end framework.

So in the use-case :

  • the user change the book's title,
  • it's saved on his PouchDB
  • it's synced on the CouchDB
  • the other clients get the book's title updated in their PouchDB
  • ... but how does the Laravel knows the book's title has been updated ?

Is there any events system it should hook on ? Maybe thrue redis ?

And once it's done, if the Laravel update the CouchDB, will it fire a sync for all the clients ?

This is a very open question, please feel free to share other solutions than Couch+Pouch.

1

1 Answers

0
votes

Have you heard of Websocket ?

This library is exactly what you want. Using PouchDB with socket connection it will open a websocket connection with server. And on the backend you will listen on same port for events.

Regarding to use it in laravel, I think you can use this package to listen on events.

Have a look at this video (just to see how sync works) https://www.youtube.com/watch?v=8jOF23dfvl4