Versions in this module Expand all Collapse all v10 v10.0.0 Apr 18, 2023 Changes in this version + const CmdAuthChallenge + const CmdAuthRequest + const CmdInternalClientID + const CmdListKeys + const CmdProtoVersion + const CmdReadBulk + const CmdReadKey + const CmdReadPrefix + const CmdRemoveKey + const CmdSubscribeKey + const CmdSubscribePrefix + const CmdUnsubscribeKey + const CmdUnsubscribePrefix + const CmdWriteBulk + const CmdWriteKey + const ProtoVersion + var ErrClientNotFound = errors.New("client not found") + var ErrorKeyNotFound = errors.New("key not found") + func MakeBackend() *mapkv + func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request) + type AuthType string + const AuthTypeChallenge + const AuthTypeInteractive + type Client interface + Close func() + Options func() ClientOptions + SendJSON func(any) + SendMessage func([]byte) + SetUID func(int64) + UID func() int64 + type ClientOptions struct + Namespace string + type Driver interface + Delete func(key string) error + Get func(key string) (string, error) + GetBulk func(keys []string) (map[string]string, error) + GetPrefix func(prefix string) (map[string]string, error) + List func(prefix string) ([]string, error) + Set func(key string, value string) error + SetBulk func(kv map[string]string) error + type ErrCode string + const ErrAuthFailed + const ErrAuthNotInit + const ErrAuthNotRequired + const ErrAuthNotSupported + const ErrAuthRequired + const ErrInvalidFmt + const ErrMissingParam + const ErrServerError + const ErrUnknownCmd + type Error struct + Details string + Error ErrCode + Ok bool + RequestID string + type Hello struct + CmdType string + Version string + type Hub struct + func NewHub(db Driver, options HubOptions, logger *zap.Logger) (*Hub, error) + func (hub *Hub) AddClient(client Client) + func (hub *Hub) Close() + func (hub *Hub) CreateWebsocketClient(w http.ResponseWriter, r *http.Request, options ClientOptions) + func (hub *Hub) RemoveClient(client Client) + func (hub *Hub) Run() + func (hub *Hub) SendMessage(msg Message) + func (hub *Hub) SetAuthenticated(id int64, authenticated bool) error + func (hub *Hub) SetOptions(options HubOptions) + func (hub *Hub) UseInteractiveAuth(fn InteractiveFn) + type HubOptions struct + Password string + type InteractiveFn func(client Client, message map[string]interface{}) bool + type LocalClient struct + func NewLocalClient(options ClientOptions, log *zap.Logger) *LocalClient + func (c *LocalClient) Close() + func (c *LocalClient) MakeRequest(cmd string, data map[string]any) (Message, <-chan any) + func (c *LocalClient) Options() ClientOptions + func (c *LocalClient) Run() + func (c *LocalClient) SendJSON(data any) + func (c *LocalClient) SendMessage(data []byte) + func (c *LocalClient) SetKeySubCallback(key string, callback SubscriptionCallback) int64 + func (c *LocalClient) SetPrefixSubCallback(key string, callback SubscriptionCallback) int64 + func (c *LocalClient) SetUID(uid int64) + func (c *LocalClient) UID() int64 + func (c *LocalClient) UnsetCallback(id int64) + func (c *LocalClient) Wait() + type Message struct + Client Client + Data []byte + type Push struct + CmdType string + Key string + NewValue string + type Request struct + CmdName string + Data map[string]interface{} + RequestID string + type Response struct + CmdType string + Data interface{} + Ok bool + RequestID string + type SubscriptionCallback func(key string, value string) + type WebsocketClient struct + func (c *WebsocketClient) Close() + func (c *WebsocketClient) Options() ClientOptions + func (c *WebsocketClient) SendJSON(data any) + func (c *WebsocketClient) SendMessage(data []byte) + func (c *WebsocketClient) SetUID(uid int64) + func (c *WebsocketClient) UID() int64 Other modules containing this package github.com/strimertul/kilovolt github.com/strimertul/kilovolt/v11 github.com/strimertul/kilovolt/v2 github.com/strimertul/kilovolt/v3 github.com/strimertul/kilovolt/v4 github.com/strimertul/kilovolt/v5 github.com/strimertul/kilovolt/v6 github.com/strimertul/kilovolt/v7 github.com/strimertul/kilovolt/v8 github.com/strimertul/kilovolt/v9