sunshine-keybase icon indicating copy to clipboard operation
sunshine-keybase copied to clipboard

better state management

Open dvc94ch opened this issue 5 years ago • 1 comments

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

dvc94ch avatar Jul 10 '20 23:07 dvc94ch

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.

shekohex avatar Jul 11 '20 14:07 shekohex