akka-js / akka.js

Akka, for Scala.js
http://akka-js.org
474 stars 39 forks source link

Add support for akka-persistence. #70

Open s3ni0r opened 7 years ago

s3ni0r commented 7 years ago

Hi, As discussed in the akka.js gitter room, here's a space where to discuss possible support for akka-persistence in scala.js. The idea is to use localstorage or indexedDb as a backend, i have a use case where i need to save mouse event data locally when an app goes offline, and then stream them to a backend server once it's back online, for now i use akka-stream to handle buffer and throttling, and pouchdb to avoid using low level indexedDb api.

jducoeur commented 7 years ago

It's awfully intriguing -- I'm not using akka.js myself yet, but in the long run this would be an argument in favor of my doing so.

I suspect that this will turn out to be most useful in the context of a larger framework, that wraps it with a concept of events flowing in both directions and a mechanism to use those events to update the local state. Certainly, I'd want a principled wrapper that has a concept of "persist these events over to the server, then flush them locally", to avoid building up dead events on the client side.

But yeah: this seems like a really useful tool towards an elegant client/server architecture that copes cleanly with the client being offline sometimes...

andreaTP commented 7 years ago

This is interesting indeed, and the use case totally justify the effort. I will try to put together a starting point in these days if I find any spare time!

andreaTP commented 7 years ago

just in case anybody is interested in help out here is the branch: https://github.com/akka-js/akka.js/tree/persistence

current status is just minimal project settings for cross-compiling and working on serialization with protobuf and ScalaPB