broadcaster

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcaster

type Broadcaster[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any]() *Broadcaster[T]

New creates a new Broadcaster with the given interval and key type.

func (*Broadcaster[T]) Broadcast

func (b *Broadcaster[T]) Broadcast(value T)

Broadcast sends the given value to all subscribers.

func (*Broadcaster[T]) Close

func (b *Broadcaster[T]) Close()

Close closes the Broadcaster. It blocks until all events have been sent to the subscribers. The Broadcaster will be a no-op after this call.

func (*Broadcaster[T]) Subscribe

func (b *Broadcaster[T]) Subscribe(ctx context.Context, ch ...chan<- T)

Subscribe adds a new event channel subscriber. If the batcher is closed, the subscriber is silently dropped.

Jump to

Keyboard shortcuts

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