service

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ClientMessageJoin  = "join"
	ClientMessageLeave = "leave"
	ClientMessageRTC   = "rtc"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	HTTP  api.Config  `toml:"http"`
	Admin AdminConfig `toml:"admin"`
}

func (APIConfig) IsValid

func (c APIConfig) IsValid() error

type AdminConfig added in v0.2.0

type AdminConfig struct {
	// Whether or not to enable admin API access.
	Enable bool `toml:"enable"`
	// The secret key used to authenticate admin requests.
	SecretKey string `toml:"secret_key"`
}

func (AdminConfig) IsValid added in v0.2.0

func (c AdminConfig) IsValid() error

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg ClientConfig) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) ErrorCh

func (c *Client) ErrorCh() <-chan error

func (*Client) ReceiveCh

func (c *Client) ReceiveCh() <-chan ClientMessage

func (*Client) Register

func (c *Client) Register(clientID string) (string, error)

func (*Client) Send

func (c *Client) Send(msg ClientMessage) error

func (*Client) Unregister

func (c *Client) Unregister(clientID string) error

type ClientConfig

type ClientConfig struct {
	ClientID string
	AuthKey  string
	URL      string
	// contains filtered or unexported fields
}

func (*ClientConfig) Parse

func (c *ClientConfig) Parse() error

type ClientMessage

type ClientMessage struct {
	Type string      `msgpack:"type"`
	Data interface{} `msgpack:"data,omitempty"`
}

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 Config

type Config struct {
	API   APIConfig
	RTC   rtc.ServerConfig
	Store StoreConfig
}

func (Config) IsValid

func (c Config) IsValid() error

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config, log mlog.LoggerIFace) (*Service, error)

func (*Service) Start

func (s *Service) Start() error

func (*Service) Stop

func (s *Service) Stop() error

type StoreConfig

type StoreConfig struct {
	DataSource string `toml:"data_source"`
}

func (StoreConfig) IsValid

func (c StoreConfig) IsValid() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL