Documentation
¶
Overview ¶
This package provides functionality to directly subscribe to streams without using channels (a simplified pub/sub mode)
Index ¶
- type CableReadyMesssage
- type Config
- type Controller
- func (c *Controller) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)
- func (c *Controller) Disconnect(sid string, env *common.SessionEnv, ids string, subscriptions []string) error
- func (c *Controller) Perform(sid string, env *common.SessionEnv, ids string, identifier string, data string) (*common.CommandResult, error)
- func (c *Controller) Shutdown() error
- func (c *Controller) Start() error
- func (c *Controller) Subscribe(sid string, env *common.SessionEnv, ids string, identifier string) (*common.CommandResult, error)
- func (c *Controller) Unsubscribe(sid string, env *common.SessionEnv, ids string, identifier string) (*common.CommandResult, error)
- type StreamResolver
- type SubscribeRequest
- type TurboMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CableReadyMesssage ¶
type CableReadyMesssage struct {
Identifier string `json:"identifier"`
}
type Config ¶
type Config struct {
// Secret is a key used to sign and verify streams
Secret string `toml:"secret"`
// Public determines if public (unsigned) streams are allowed
Public bool `toml:"public"`
// Whisper determines if whispering is enabled for pub/sub streams
Whisper bool `toml:"whisper"`
// PubSubChannel is the channel name used for direct pub/sub
PubSubChannel string `toml:"pubsub_channel"`
// Turbo is a flag to enable Turbo Streams support
Turbo bool `toml:"turbo"`
// TurboSecret is a custom secret key used to verify Turbo Streams
TurboSecret string `toml:"turbo_secret"`
// CableReady is a flag to enable CableReady support
CableReady bool `toml:"cable_ready"`
// CableReadySecret is a custom secret key used to verify CableReady streams
CableReadySecret string `toml:"cable_ready_secret"`
}
func (Config) GetCableReadySecret ¶
func (Config) GetTurboSecret ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewCableReadyController ¶
func NewCableReadyController(key string, l *slog.Logger) *Controller
func NewController ¶
func NewController(key string, resolver StreamResolver, l *slog.Logger) *Controller
func NewStreamsController ¶
func NewStreamsController(conf *Config, l *slog.Logger) *Controller
func NewTurboController ¶
func NewTurboController(key string, l *slog.Logger) *Controller
func (*Controller) Authenticate ¶
func (c *Controller) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)
func (*Controller) Disconnect ¶
func (c *Controller) Disconnect(sid string, env *common.SessionEnv, ids string, subscriptions []string) error
func (*Controller) Perform ¶
func (c *Controller) Perform(sid string, env *common.SessionEnv, ids string, identifier string, data string) (*common.CommandResult, error)
func (*Controller) Shutdown ¶
func (c *Controller) Shutdown() error
func (*Controller) Start ¶
func (c *Controller) Start() error
func (*Controller) Subscribe ¶
func (c *Controller) Subscribe(sid string, env *common.SessionEnv, ids string, identifier string) (*common.CommandResult, error)
func (*Controller) Unsubscribe ¶
func (c *Controller) Unsubscribe(sid string, env *common.SessionEnv, ids string, identifier string) (*common.CommandResult, error)
type StreamResolver ¶
type StreamResolver = func(string) (*SubscribeRequest, error)
type SubscribeRequest ¶
type SubscribeRequest struct {
StreamName string `json:"stream_name"`
SignedStreamName string `json:"signed_stream_name"`
// contains filtered or unexported fields
}
func (*SubscribeRequest) IsPresent ¶
func (r *SubscribeRequest) IsPresent() bool
type TurboMessage ¶
type TurboMessage struct {
SignedStreamName string `json:"signed_stream_name"`
}
Click to show internal directories.
Click to hide internal directories.