vmware-labs / wasm-workers-server

🚀 Develop and run serverless applications on WebAssembly

Home Page:https://workers.wasmlabs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Events

gedw99 opened this issue · comments

commented

Is your feature request related to a problem? Please describe.

SSE is the browsers way to send an event.

So how can we design an SSE abstraction for Server side workers.

also in a browser web workers use message passing so it’s not SSE after all.

It would be great if a worker can publish an event and any other worker can get it over a broadcast or pub sub mechanism.

Describe the solution you'd like

I don’t know how to map the pub sub pattern onto this project architecture.

broadcasting to all other workers would flood the system so that’s why we need a pub sub mechanism.

Describe alternatives you've considered

Event systems are meant to be late bound in that who do dunes the event is unknown at design time.

i guess a namespace with topics and subjects would be a decent structure into which an event can be published.

Then each workers that wants to listen for events can describe it in their config.

Additional context

To me there is sone aspect of this that relates to kv which was recently introduced.

I was thinking that we Puls reuse the kv system in order to hold and forward the event . It’s really like a kv with a watch flag in that you want to listen for any changes on that kv namespace.

So if you follow my gist then if the kv had a namespace then we can store data in kv as well as route events with it.

Most event systems have durability for the serverless pattern because that other service may not be running and so it can get the event later when it is up. So if I wanted this I would run a durable kv / pub System elsewhere and have my wasm code call that Server cluster. I imagine the endpoint would be an environment variable. So I wanted to ask if the team has any thoughts on how to describe external servers and how best to lay out config for workers to know this config