Documentation ¶
Index ¶
Constants ¶
View Source
const ( CmdProtoVersion = "version" CmdReadKey = "kget" CmdReadBulk = "kget-bulk" CmdReadPrefix = "kget-all" CmdWriteKey = "kset" CmdWriteBulk = "kset-bulk" CmdSubscribeKey = "ksub" CmdSubscribePrefix = "ksub-prefix" CmdUnsubscribeKey = "kunsub" CmdUnsubscribePrefix = "kunsub-prefix" CmdListKeys = "klist" )
Commands
View Source
const ( ErrServerError = "server error" ErrInvalidFmt = "invalid message format" ErrMissingParam = "required parameter missing" ErrUnknownCmd = "unknown command" )
View Source
const ProtoVersion = "v5"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client interface { Options() ClientOptions Close() SendMessage([]byte) SendJSON(interface{}) SetUID(int64) UID() int64 }
type ClientOptions ¶
type ClientOptions struct { // Adds a prefix to all key operations to restrict them to a namespace Namespace string }
ClientOptions is a list of tweakable options for clients
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func (*Hub) CreateClient ¶
func (hub *Hub) CreateClient(w http.ResponseWriter, r *http.Request, options ClientOptions)
CreateClient upgrades a HTTP request to websocket and makes it a client for the hub
type WebsocketClient ¶
type WebsocketClient struct {
// contains filtered or unexported fields
}
Client is a middleman between the websocket connection and the hub.
func (*WebsocketClient) Close ¶
func (c *WebsocketClient) Close()
func (*WebsocketClient) Options ¶
func (c *WebsocketClient) Options() ClientOptions
func (*WebsocketClient) SendJSON ¶
func (c *WebsocketClient) SendJSON(data interface{})
func (*WebsocketClient) SendMessage ¶
func (c *WebsocketClient) SendMessage(data []byte)
func (*WebsocketClient) SetUID ¶
func (c *WebsocketClient) SetUID(uid int64)
func (*WebsocketClient) UID ¶
func (c *WebsocketClient) UID() int64
Source Files ¶
Click to show internal directories.
Click to hide internal directories.