Documentation
¶
Index ¶
Constants ¶
View Source
const ( EventDirect = "direct_signal" EventRoom = "room_signal" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
Kind() string
Publish(context.Context, Event) error
Subscribe(func(Event)) (io.Closer, error)
Close() error
}
Backend publishes and subscribes to cluster events.
type Event ¶
type Event struct {
Type string `json:"type"`
NodeID string `json:"node_id"`
RoomID string `json:"room_id,omitempty"`
SenderID string `json:"sender_id,omitempty"`
Signal core.Signal `json:"signal"`
}
Event represents a cluster fanout unit replicated across nodes.
type MemoryBackend ¶
type MemoryBackend struct {
// contains filtered or unexported fields
}
MemoryBackend provides in-process fanout for tests and local development.
func NewMemoryBackend ¶
func NewMemoryBackend() *MemoryBackend
func (*MemoryBackend) Close ¶
func (b *MemoryBackend) Close() error
func (*MemoryBackend) Kind ¶
func (b *MemoryBackend) Kind() string
type NATSBackend ¶
type NATSBackend struct {
// contains filtered or unexported fields
}
func NewNATSBackend ¶
func NewNATSBackend(url, subject string) (*NATSBackend, error)
func (*NATSBackend) Close ¶
func (b *NATSBackend) Close() error
func (*NATSBackend) Kind ¶
func (b *NATSBackend) Kind() string
type RedisBackend ¶
type RedisBackend struct {
// contains filtered or unexported fields
}
func NewRedisBackend ¶
func NewRedisBackend(addr, password string, db int, channel string) (*RedisBackend, error)
func (*RedisBackend) Close ¶
func (b *RedisBackend) Close() error
func (*RedisBackend) Kind ¶
func (b *RedisBackend) Kind() string
Click to show internal directories.
Click to hide internal directories.