8000 GitHub - twpayne/go-pubsub: Package pubsub is a simple publish-subscribe implementation using generics.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

twpayne/go-pubsub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-pubsub

PkgGoDev

Package pubsub is a simple publish-subscribe implementation using generics.

Example

ctx := context.Background()

topic := pubsub.NewTopic[int](ctx)

ch := make(chan int)
topic.Subscribe(ctx, ch)
go func() {
    defer topic.Close()
    for i := range 3 {
        topic.Publish(ctx, i)
    }
}()

for i := range ch {
    fmt.Println(i)
}

License

MIT

About

Package pubsub is a simple publish-subscribe implementation using generics.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages

0