ssepubsub

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InProcPubSubClient

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

func NewInProcPubSubClient

func NewInProcPubSubClient() *InProcPubSubClient

func (*InProcPubSubClient) Publish

func (c *InProcPubSubClient) Publish(ctx context.Context, topic string, event SSEEvent) error

func (*InProcPubSubClient) SSESubscribe

func (c *InProcPubSubClient) SSESubscribe(ctx context.Context, topic string) (<-chan SSEEvent, error)

type MessageHandler

type MessageHandler func(topic string, event SSEEvent)

MessageHandler is a function type for handling incoming messages

type NATSPubSubClient

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

func NewNATSPubSubClient

func NewNATSPubSubClient(conn *nats.Conn) *NATSPubSubClient

func (*NATSPubSubClient) Publish

func (c *NATSPubSubClient) Publish(_ context.Context, topic string, event SSEEvent) error

func (*NATSPubSubClient) SSESubscribe

func (c *NATSPubSubClient) SSESubscribe(ctx context.Context, topic string) (<-chan SSEEvent, error)

type PubSubClient

type PubSubClient interface {
	SSESubscribe(ctx context.Context, topic string) (<-chan SSEEvent, error)
	Publish(ctx context.Context, topic string, event SSEEvent) error
}

PubSubClient defines the interface for a pub/sub system client

type RedisPubSubClient

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

func NewRedisPubSubClient

func NewRedisPubSubClient(client *redis.Client) *RedisPubSubClient

func (*RedisPubSubClient) Publish

func (c *RedisPubSubClient) Publish(ctx context.Context, subject string, event SSEEvent) error

func (*RedisPubSubClient) SSESubscribe

func (c *RedisPubSubClient) SSESubscribe(ctx context.Context, subject string) (<-chan SSEEvent, error)

type SSEEvent

type SSEEvent struct {
	Type string `json:"type"`
	Data string `json:"data"`
}

Jump to

Keyboard shortcuts

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