Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update browser when WasmServer recompiles the code on the backend #2

Open
gedw99 opened this issue Mar 11, 2024 · 2 comments
Open

update browser when WasmServer recompiles the code on the backend #2

gedw99 opened this issue Mar 11, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@gedw99
Copy link

gedw99 commented Mar 11, 2024

wonderful stuff and thank you for this.

I ran the example TODO with wasmserve and the first thing I wanted was for the Browser to update automagically.

I wonder if we can send a signal to the wasm running in the browser to force the GUI to update ?


also been playing with https://github.com/tractordev/wanix and figured you might be interested too.

It's a shell and FS inside the browser. All golang and wasm.

It feel like mass and wanix are synergistic. wanix as the OS and mass are the rendering engine.

Let me know what you think :)

@gedw99 gedw99 added the enhancement New feature or request label Mar 11, 2024
@cwarden
Copy link
Member

cwarden commented Mar 11, 2024

Any thoughts on how we should maintain state across reloads?

@gedw99
Copy link
Author

gedw99 commented Mar 12, 2024

Any thoughts on how we should maintain state across reloads?

It really depends on the objectives of the project and where you want the state to live.

One way is to use NATS Jetstream which is reactive, so many clients get updated on a single state change.

Server: https://github.com/nats-io/nats-server
Client: https://github.com/nats-io/nats.go compiles to WASM.

Then from there it is possible to trigger updates at the many levels of granularity that are needed. Even the Props via the NATS KV store.

  1. On WASM binary change, sent event to Client, and it does full reload.
  2. On user data state change, NATS can automatically trigger state updates to the Client and so the client can re-render the "views" linked to that golang struct state.

You can also just use a SSE Proxy and so then there is no need to import NATS.go to the client wasm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants