Help us shape the future of Go! Take the 2026 Go Developer Survey

broadcasting

package
v1.20.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelPrefixPrivate  = "private-"
	ChannelPrefixPresence = "presence-"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Enabled    bool
	Path       string
	Middleware []contractshttp.Middleware
}

type AuthResponse

type AuthResponse struct {
	Auth        string `json:"auth"`
	ChannelData string `json:"channel_data,omitempty"`
}

type Broadcast

type Broadcast interface {
	Channel(pattern string, callback ChannelAuthFunc)
	Dispatch(ctx context.Context, event ShouldBroadcast) error
}

type ChannelAuthFunc

type ChannelAuthFunc func(ctx context.Context, userID any, channelName string, params map[string]string) (bool, any)

type ConnectionConfig

type ConnectionConfig struct {
	Driver  string
	Key     string
	Secret  string
	AppID   string `json:"app_id"`
	Options map[string]any
}

type Driver

type Driver interface {
	Broadcast(ctx context.Context, channels []string, event string, payload map[string]any) error
}

type PusherOptions

type PusherOptions struct {
	Cluster string
	Host    string
	Port    int
	Scheme  string
}

type ShouldBroadcast

type ShouldBroadcast interface {
	BroadcastOn() []string
	BroadcastAs() string
	BroadcastWith() map[string]any
	BroadcastWhen() bool
}

type ShouldBroadcastNow

type ShouldBroadcastNow interface {
	BroadcastNow() bool
}

type ShouldBroadcastWithBackoff

type ShouldBroadcastWithBackoff interface {
	// BroadcastBackoff returns the delay before each retry attempt, in
	// order; the last value repeats for subsequent attempts. It applies
	// to every retry, whether capped by the event's own BroadcastTries
	// or the queue worker's Tries config; the last value repeats.
	BroadcastBackoff() []time.Duration
}

type ShouldBroadcastWithConnections

type ShouldBroadcastWithConnections interface {
	BroadcastConnections() []string
}

type ShouldBroadcastWithDelay

type ShouldBroadcastWithDelay interface {
	BroadcastDelay() time.Time
}

type ShouldBroadcastWithQueue

type ShouldBroadcastWithQueue interface {
	BroadcastQueue() string
}

type ShouldBroadcastWithQueueConnection

type ShouldBroadcastWithQueueConnection interface {
	BroadcastQueueConnection() string
}

type ShouldBroadcastWithTimeout

type ShouldBroadcastWithTimeout interface {
	BroadcastTimeout() time.Duration
}

type ShouldBroadcastWithTries

type ShouldBroadcastWithTries interface {
	// BroadcastTries returns the maximum number of attempts for the
	// queued broadcast. 0 / not implementing the interface means no
	// retry policy is declared and the queue worker's Tries config
	// applies.
	BroadcastTries() int
}

Jump to

Keyboard shortcuts

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