Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 790 Bytes

README.md

File metadata and controls

33 lines (22 loc) · 790 Bytes

chanbus

build.yaml Go Reference golangci.yaml

Package chanbus is a 1:n channel broadcasting for golang.

Install

go get github.com/go-laeo/chanbus

Example

// First 0 means no buffer of main channel, and second
// 0 means blocking on forwarding to derived channels.
ch := chanbus.New(1, 0)

// Send value to main channel.
ch.Send("say, hi")

// Derives new readonly channel
nch := ch.Derive(1)

for v := range nch {
    fmt.Println(v) // say, hi
}

License

The MIT license.