sunshine-protocol / sunshine-keybase

Keybase Local Key Security implementation, using Ipfs-Embed + Substrate
The Unlicense
34 stars 6 forks source link

better state management #42

Open dvc94ch opened 4 years ago

dvc94ch commented 4 years ago

The current state management was built for a cli not a ui

shekohex commented 4 years ago

Hey, as we were discussing that yesterday. we got an idea is that the client sends a stream of events to the Dart and from there these events should derive the UI state and update them as we receive them.

I made a simple demo of how we could use Rust streams/channels from the Dart side. https://github.com/shekohex/rustystream

The problem is how we could encode different events on the same stream, for my demo I went with JSON as it is universal between languages, but JSON is not strongly-typed and has a lot of overhead, so maybe we could use something like protocol buffers so we get both a unified schema (contract) between Dart and Rust, also we get code generator for both languages for free.

In Rust, we will use prost and for Dart, we will use the official google package that gets auto-generated for us see here.