jfyne / live

Live views and components for golang
https://discord.gg/TuMNaXJMUG
MIT License
655 stars 27 forks source link

Render on client #35

Closed gedw99 closed 2 years ago

gedw99 commented 2 years ago

I like your simple approach . It’s very clean .

Also your using a web socket lib that works on everything including when I compile to wasm

so I don’t know if you are into the idea but you can use gioui to render on the client

then your sending the data change event to the client only . A CUD of Created, Updated or Deleted .

There are plenty examples in gioui

if your curious I can point you to some

It’s also crazy fast and will work on web, desktop and mobile

mit can also work inside a webview .

jfyne commented 2 years ago

I am interested in client side compilation, and especially interested in rewriting the typescript component of this project in go. However from my limited testing I found the wasm output and runtime to be too large for my web uses.

What's stopping gioui being used now?

gedw99 commented 2 years ago

absolutely nothing is preventing me or someone else using the code in gioui.

nhooyr.io/websocket works when cross compiled to WASM. Have used it with GIO.

Not sure if the gorilla sessions will work. Need to try.

The difference is that the jfyne/live system will return markdown, NOT html. GIO already has a markdown renderer. https://github.com/gioui/gio-x/blob/main/markdown/markdown.go SO will work i think. GIOUI then just renders the markdown.

In terms of postbacks / mutations, i am not sure yet as i have not had time to look deeply.

gedw99 commented 2 years ago

Also the JS code would just be golang, and compiled in. https://github.com/jfyne/live/blob/master/web/src/events.ts#L8 would model the clicks

all the other js code looks pretty easy to modify to be golang.

The more i look at the code, the more i like it BTW. It has clean concepts

jfyne commented 2 years ago

It should be easy to replace gorilla cookies with another session provider of it doesn't work, that's just an implementation of the interface I wrote.

gedw99 commented 2 years ago

True

the more I ponder this the more I like it ...

it will allow web desktop and mobile apps to be changeable at runtime by changing the templates and what data you feed to it

sort of becoming a lambda architecture.

I am not sold on markup being the right description Lang. Am more leaning towards json schema because it also has validation and is extensible .

a json schema rendering system inside gio and backend is easy .

it might also be a good way to describe pure html gui long term for you too

gedw99 commented 2 years ago

Also the web code, if made into golang, can be compiled using tinygo . It will be 50 to 100 kv then and both html and gio guis can use it . Just a thought