broadcast

package
v0.7.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2019 License: MIT Imports: 2 Imported by: 2

Documentation

Overview

https://github.com/tjgq/broadcast/blob/master/broadcast.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcaster

type Broadcaster struct {
	// contains filtered or unexported fields
}

Broadcaster implements a broadcast channel. The zero value is a usable unbuffered channel.

func NewBroadcaster

func NewBroadcaster(n int) *Broadcaster

NewBroadcaster returns a new Broadcaster with the given capacity (0 means unbuffered).

func (*Broadcaster) Close

func (b *Broadcaster) Close()

Close closes the channel, disabling the sending of further messages.

func (*Broadcaster) Listen

func (b *Broadcaster) Listen() *Listener

Listen returns a Listener for the broadcast channel.

func (*Broadcaster) Send

func (b *Broadcaster) Send(v interface{})

Send broadcasts a message to the channel.

type Listener

type Listener struct {
	// Ch receives the broadcast messages.
	Ch <-chan interface{}
	// contains filtered or unexported fields
}

Listener implements a listening endpoint for a broadcast channel.

func (*Listener) Close

func (l *Listener) Close()

Close closes the Listener, disabling the receival of further messages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL