jfyne / live

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

PubSub implementation #24

Closed jfyne closed 3 years ago

jfyne commented 3 years ago

This PR allows multiple instances to communicate via Broadcast.

See this for a more complex example https://github.com/jfyne/live-examples/pull/4

jfyne commented 3 years ago

@dstpierre this is my first pass at what we discussed. There is a new PubSub primitive (which I might change the name of) and a PubSubTransport interface so that you can bring your own message broker. Included is a LocalTransport which can enable in process communication between handlers.

There is an example linked that shows how to use the Go CDK to achieve multi node broadcasting. It uses an in memory broker in the example, but it would be trivial to change it to one of the many brokers the Go CDK supports.

I'm going to keep playing with this, before I merge it.