incus

package
v0.0.0-...-65e9c33 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ClientsKey = "SocketClients"
View Source
const PageKey = "PageClients"

Variables

View Source
var CLIENT_BROAD bool
View Source
var DEBUG bool

Functions

This section is empty.

Types

type CommandMsg

type CommandMsg struct {
	Command map[string]string      `json:"command"`
	Message map[string]interface{} `json:"message,omitempty"`
}

func (*CommandMsg) FromApp

func (this *CommandMsg) FromApp(server *Server)

func (*CommandMsg) FromRedis

func (this *CommandMsg) FromRedis(server *Server)

func (*CommandMsg) FromSocket

func (this *CommandMsg) FromSocket(sock *Socket)

type Configuration

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

func InitConfig

func InitConfig(mymap map[string]string) Configuration

func (*Configuration) Get

func (this *Configuration) Get(name string) string

func (*Configuration) GetBool

func (this *Configuration) GetBool(name string) bool

func (*Configuration) GetInt

func (this *Configuration) GetInt(name string) int

type MemoryStore

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

func (*MemoryStore) Client

func (this *MemoryStore) Client(UID string) (map[string]*Socket, error)

func (*MemoryStore) Clients

func (this *MemoryStore) Clients() map[string]map[string]*Socket

func (*MemoryStore) Count

func (this *MemoryStore) Count() (int64, error)

func (*MemoryStore) Remove

func (this *MemoryStore) Remove(sock *Socket) error

func (*MemoryStore) Save

func (this *MemoryStore) Save(sock *Socket) error

func (*MemoryStore) SetPage

func (this *MemoryStore) SetPage(sock *Socket) error

func (*MemoryStore) UnsetPage

func (this *MemoryStore) UnsetPage(sock *Socket) error

type Message

type Message struct {
	Event string                 `json:"event"`
	Data  map[string]interface{} `json:"data"`
	Time  int64                  `json:"time"`
}

type RedisStore

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

func (*RedisStore) Clients

func (this *RedisStore) Clients() ([]string, error)

func (*RedisStore) CloseConn

func (this *RedisStore) CloseConn(conn *redis.Client)

func (*RedisStore) Count

func (this *RedisStore) Count() (int64, error)

func (*RedisStore) GetConn

func (this *RedisStore) GetConn() (*redis.Client, error)

func (*RedisStore) Publish

func (this *RedisStore) Publish(channel string, message string)

func (*RedisStore) Remove

func (this *RedisStore) Remove(sock *Socket) error

func (*RedisStore) Save

func (this *RedisStore) Save(sock *Socket) error

func (*RedisStore) SetPage

func (this *RedisStore) SetPage(sock *Socket) error

func (*RedisStore) Subscribe

func (this *RedisStore) Subscribe(c chan []string, channel string) (*redis.Client, error)

func (*RedisStore) UnsetPage

func (this *RedisStore) UnsetPage(sock *Socket) error

type Server

type Server struct {
	ID     string
	Config *Configuration
	Store  *Storage

	Debug bool
	// contains filtered or unexported fields
}

func CreateServer

func CreateServer(conf *Configuration, store *Storage) *Server

func (*Server) AppListener

func (this *Server) AppListener(msg interface{})

func (*Server) LongPollListener

func (this *Server) LongPollListener(w http.ResponseWriter, r *http.Request)

func (*Server) RedisListener

func (this *Server) RedisListener()

func (*Server) SendHeartbeats

func (this *Server) SendHeartbeats()

func (*Server) SocketListener

func (this *Server) SocketListener(w http.ResponseWriter, r *http.Request)

type Socket

type Socket struct {
	SID  string // socket ID, randomly generated
	UID  string // User ID, passed in via client
	Page string // Current page, if set.

	Server *Server

	Debug bool
	// contains filtered or unexported fields
}

func (*Socket) Authenticate

func (this *Socket) Authenticate(UID string) error

func (*Socket) Close

func (this *Socket) Close() error

type Storage

type Storage struct {
	StorageType string
	// contains filtered or unexported fields
}

func InitStore

func InitStore(Config *Configuration) *Storage

func (*Storage) Client

func (this *Storage) Client(UID string) (map[string]*Socket, error)

func (*Storage) ClientList

func (this *Storage) ClientList() ([]string, error)

func (*Storage) Clients

func (this *Storage) Clients() map[string]map[string]*Socket

func (*Storage) Count

func (this *Storage) Count() (int64, error)

func (*Storage) Remove

func (this *Storage) Remove(sock *Socket) error

func (*Storage) Save

func (this *Storage) Save(sock *Socket) error

func (*Storage) SetPage

func (this *Storage) SetPage(sock *Socket) error

func (*Storage) UnsetPage

func (this *Storage) UnsetPage(sock *Socket) error

Jump to

Keyboard shortcuts

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