From dba01de4254c40a7a0fe6f2106889d6a82f251d7 Mon Sep 17 00:00:00 2001 From: Natercio Moniz Date: Mon, 9 Sep 2024 14:45:21 +0100 Subject: [PATCH] added example for Feed subscriber --- example/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/example/main.go b/example/main.go index 6ad531c..ad767ad 100644 --- a/example/main.go +++ b/example/main.go @@ -21,7 +21,13 @@ func main() { topic.Subscribe(gubgub.Buffered(gubgub.Forever(Slow))) - fmt.Printf("Use 'Ctrl+C' to exit! Type messages followed by 'Enter' to publish them:\n") + go func() { + for s := range gubgub.Feed(topic, false) { + log.Printf("ForRange: %s", s) + } + }() + + fmt.Printf("Use 'Ctrl+C' to exit! Type a message followed by 'Enter' to publish it:\n") scanner := bufio.NewScanner(os.Stdin) for { scanner.Scan()