jerson / openpgp-mobile

Native code used in react-native-fast-openpgp and flutter-openpgp
https://github.com/jerson/flutter-openpgp
MIT License
24 stars 10 forks source link

question about pushing data from golang to flutter #9

Closed gedw99 closed 2 years ago

gedw99 commented 3 years ago

I am using this architecture and was wondering if it supports a call initiated from the golang client to the Flutter client.

The reason is because i am extending the golang client code to use NATS and / or grpc. Am not sure which one yet.

I am mostly intersted in the target with WASM and FLutter actually, because flutter supports the "Add to Home Screen" so well, and so dont really need to walk through the Google and Apple app store hell ...

So the Backend ( whatever it will be ), will send data to the golang client, and then to the Flutter GUI.

thanks :)

jerson commented 3 years ago

hello, thanks for the question, I don't think I'm very expert on the subject, but I think you could create as you mention a kind of pub sub to do it, I think it would have to be outside the library but I can try to prepare in these days a proof of concept (in a branch) of something like what you mention.

jerson commented 3 years ago

after a brief research about this seems more complex than i thought but the main thing is to allow pass function in binding method

https://github.com/jerson/openpgp-mobile/blob/master/binding/main.go#L13 go ref: https://github.com/golang/go/wiki/cgo#function-variables

that should be created in dart side and casted in go side, but it depends on a subscribe method, subscribe a method with a funcion and called from go, but probably deserve it own library

gedw99 commented 3 years ago

Hey

thanks for the detailed links. They make sense.

I am trying to extend your architecture to allow using wasm on the server and on the client.

WASM running on the server has a WASI std lib ( for want of a better word ) that allows this pub sub like pattern . Thus is allows the wasm layer to send and receive messages.

And in the browser that is exactly how the wasm layer communicates with the bowser window.

I am currently using NATS Jetstream for the server bus to allow wasm instance to communicate with each other. This allows the WASM instances to be on any server.

gedw99 commented 3 years ago

I would like to extend the current architecture to support this above type of setup.

I am open to collaboration if anyone else is interested in this concept.

Please chime in with your thoughts and needs and let’s see if we can form a working group to extend from the excellent base Jerson has pioneered