Documentation ¶
Index ¶
Constants ¶
View Source
const ( CmdProtoVersion = "version" CmdReadKey = "kget" CmdWriteKey = "kset" CmdSubscribeKey = "ksub" CmdUnsubscribeKey = "kunsub" )
Commands
View Source
const ( ErrInvalidFmt = "invalid message format" ErrMissingParam = "required parameter missing" ErrUpdateFailed = "server update failed" ErrUnknownCmd = "unknown command" )
View Source
const ProtoVersion = "v2"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a middleman between the websocket connection and the hub.
type ClientOptions ¶ added in v2.1.0
type ClientOptions struct { // RemapKeyFn is a optional function for remapping keys so they can be namespaced properly RemapKeyFn func(key string) string }
ClientOptions is a list of tweakable options for clients
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func NewHub ¶
func NewHub(db *badger.DB, logger logrus.FieldLogger) *Hub
func (*Hub) CreateClient ¶ added in v2.1.0
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
Click to show internal directories.
Click to hide internal directories.