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

Example for two way communication with a background goroutine #1244

Open
mdepot opened this issue Nov 20, 2024 · 3 comments
Open

Example for two way communication with a background goroutine #1244

mdepot opened this issue Nov 20, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@mdepot
Copy link

mdepot commented Nov 20, 2024

This is to request a new example showing two way communication between bubbletea and a background process (running as a goroutine.) There are already two examples (send-msg and realtime) which demonstrate one way communication with bubbletea, however it would seem to be a common use case to need two way communication.

For example, the background process may do some work and need to be able to push updates into the model so that the results can be displayed in the interface. But it also makes sense that the background process might want to change its behavior based on the user interacting with the interface, meaning it also needs to also be able to pull information from the model. It would be great to have an example showing this two way communication, a background goroutine that changes its behavior based on flags in the model, as well as the model being updated based on work done in the background goroutine.

@mdepot mdepot added the enhancement New feature or request label Nov 20, 2024
@FFCoder
Copy link

FFCoder commented Nov 20, 2024

@mdepot This is a great idea I think! Are you working on a potential PR for this?

@meowgorithm
Copy link
Member

Great idea. This would be really useful (and fun to make).

@M0hammadUsman
Copy link

I've submitted a PR that includes an example addressing the requested use case. I would greatly appreciate your insights and feedback!

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

No branches or pull requests

4 participants