Documentation ¶
Index ¶
- Constants
- func NewPackedClientMessage(msgType string, data interface{}) ([]byte, error)
- type APIConfig
- type Client
- func (c *Client) Close() error
- func (c *Client) Connect() error
- func (c *Client) Connected() bool
- func (c *Client) ErrorCh() <-chan error
- func (c *Client) GetSystemInfo() (SystemInfo, error)
- func (c *Client) GetVersionInfo() (VersionInfo, error)
- func (c *Client) ReceiveCh() <-chan ClientMessage
- func (c *Client) Register(clientID string, authKey string) error
- func (c *Client) Send(msg ClientMessage) error
- func (c *Client) Unregister(clientID string) error
- type ClientConfig
- type ClientMessage
- type ClientOption
- type ClientReconnectCb
- type Config
- type DialContextFn
- type SecurityConfig
- type Service
- type StoreConfig
- type SystemInfo
- type VersionInfo
Constants ¶
View Source
const ( ClientMessageJoin = "join" ClientMessageLeave = "leave" ClientMessageRTC = "rtc" ClientMessageHello = "hello" ClientMessageReconnect = "reconnect" ClientMessageClose = "close" ClientMessageVAD = "vad" )
Variables ¶
This section is empty.
Functions ¶
func NewPackedClientMessage ¶ added in v0.6.10
Types ¶
type APIConfig ¶
type APIConfig struct { HTTP api.Config `toml:"http"` Security SecurityConfig `toml:"security"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(cfg ClientConfig, opts ...ClientOption) (*Client, error)
func (*Client) GetSystemInfo ¶ added in v0.15.0
func (c *Client) GetSystemInfo() (SystemInfo, error)
func (*Client) GetVersionInfo ¶ added in v0.8.0
func (c *Client) GetVersionInfo() (VersionInfo, error)
func (*Client) ReceiveCh ¶
func (c *Client) ReceiveCh() <-chan ClientMessage
func (*Client) Send ¶
func (c *Client) Send(msg ClientMessage) error
func (*Client) Unregister ¶
type ClientConfig ¶
type ClientConfig struct { ClientID string AuthKey string URL string ReconnectInterval time.Duration // contains filtered or unexported fields }
func (*ClientConfig) Parse ¶
func (c *ClientConfig) Parse() error
type ClientMessage ¶
func NewClientMessage ¶
func NewClientMessage(msgType string, data interface{}) *ClientMessage
func (*ClientMessage) DecodeMsgpack ¶
func (cm *ClientMessage) DecodeMsgpack(dec *msgpack.Decoder) error
func (*ClientMessage) EncodeMsgpack ¶
func (cm *ClientMessage) EncodeMsgpack(enc *msgpack.Encoder) error
func (*ClientMessage) Pack ¶
func (cm *ClientMessage) Pack() ([]byte, error)
func (*ClientMessage) Unpack ¶
func (cm *ClientMessage) Unpack(data []byte) error
type ClientOption ¶
func WithClientReconnectCb ¶
func WithClientReconnectCb(cb ClientReconnectCb) ClientOption
WithClientReconnectCb lets the caller set an optional callback to be called prior to performing a WebSocket reconnection.
func WithDialFunc ¶ added in v0.5.0
func WithDialFunc(dialFn DialContextFn) ClientOption
WithDialFunc lets the caller set an optional dialing function to setup the HTTP/WebSocket connections used by the client.
type ClientReconnectCb ¶
type Config ¶
type Config struct { API APIConfig RTC rtc.ServerConfig Store StoreConfig Logger logger.Config }
func (*Config) SetDefaults ¶
func (c *Config) SetDefaults()
type DialContextFn ¶ added in v0.5.0
type SecurityConfig ¶
type SecurityConfig struct { // Whether or not to enable admin API access. EnableAdmin bool `toml:"enable_admin"` // The secret key used to authenticate admin requests. AdminSecretKey string `toml:"admin_secret_key"` // Whether or not to allow clients to self-register. AllowSelfRegistration bool `toml:"allow_self_registration"` SessionCache auth.SessionCacheConfig `toml:"session_cache"` }
func (SecurityConfig) IsValid ¶
func (c SecurityConfig) IsValid() error
type StoreConfig ¶
type StoreConfig struct {
DataSource string `toml:"data_source"`
}
func (StoreConfig) IsValid ¶
func (c StoreConfig) IsValid() error
type SystemInfo ¶ added in v0.15.0
type SystemInfo struct {
CPULoad float64 `json:"cpu_load"`
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.