duyduong / interactive_webview

Plugin that allow Flutter to communicate with a native WebView.
MIT License
45 stars 33 forks source link

generic example #1

Closed ghost closed 5 years ago

ghost commented 5 years ago

This is really useful for running differnt background code. Can you make a genric example showing messages flowing back and forth. Please include the html and javascript in the example.

duyduong commented 5 years ago

Please check the example folder, the html file is inside assets folder.

You can run the example, click on button and check the result on console.

ghost commented 5 years ago

Hey @duyduong . Yeah i saw that before the asked for better demo :) The reason i ask is that i can can see how useful this architecture is for running code on the devie without having to push a new update to the app store. Solves a big problem.

So i was thinking of using webworkers and WASM inside the webview to do work. The reason for WASM is because you can code in Rust or golang or c, etc.

The example is lacking for me to see if this is likely to work yet. For example the workers will need to push updates back to the Flutter layer, etc. But in general i just wanted a bit more of a fleshd out example to show RPC happening between flutter and the code running in the webview.

Hopefully this use case is something your also contemplating ?

duyduong commented 5 years ago

Hey sorry, I would love to write an example like u said but I am not familiar with WebAssembly or Rust

The general idea that I created this plugins is to allow u to create a mobile application without server side (serverless application). The case study is, u want to write a news application, but don't have api to get data from, but u know a website showing data u need. So u can use this plugin, create a html file, inject jquery then u can parsing and send back data to flutter. It is promising right? A serverless application

ghost commented 5 years ago

@duyduong thanks again for the explanation. Knowing your use case does help alot !

There is a golang VM that runs WASM. This would mean that you would not need the webview at all. https://github.com/perlin-network/life

there are many examples out there.

Getting golang to run with Flutter oon mobiles is also pretty easy. https://github.com/empirefox/flutter_dial_go

If you want help we can collaborate as i use the same things

duyduong commented 5 years ago

@gedw99 Actually I am quite busy on other stuff for now. Will tell u later when everything is out, then we can collaborate in cool projects

duyduong commented 5 years ago

Example has been updated