Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigOption(key string, default_value interface{}) string
- func NewConfig(configFilePath string)
- type CommandMsg
- type DatadogStats
- func (d *DatadogStats) LogAPNSError()
- func (d *DatadogStats) LogAPNSPush()
- func (d *DatadogStats) LogBroadcastMessage()
- func (d *DatadogStats) LogClientCount(clients int64)
- func (d *DatadogStats) LogCommand(from, cmdType string)
- func (d *DatadogStats) LogGCMError()
- func (d *DatadogStats) LogGCMFailure()
- func (d *DatadogStats) LogGCMPush()
- func (d *DatadogStats) LogGoroutines(goroutines int)
- func (d *DatadogStats) LogInvalidJSON()
- func (d *DatadogStats) LogLongpollConnect()
- func (d *DatadogStats) LogLongpollDisconnect()
- func (d *DatadogStats) LogPageMessage()
- func (d *DatadogStats) LogPendingRedisActivityCommandsListLength(length int)
- func (d *DatadogStats) LogReadMessage()
- func (d *DatadogStats) LogStartup()
- func (d *DatadogStats) LogUserMessage()
- func (d *DatadogStats) LogWebsocketConnection()
- func (d *DatadogStats) LogWebsocketDisconnection()
- func (d *DatadogStats) LogWriteMessage()
- type DiscardStats
- func (d *DiscardStats) LogAPNSError()
- func (d *DiscardStats) LogAPNSPush()
- func (d *DiscardStats) LogBroadcastMessage()
- func (d *DiscardStats) LogClientCount(int64)
- func (d *DiscardStats) LogCommand(from, cmdType string)
- func (d *DiscardStats) LogGCMError()
- func (d *DiscardStats) LogGCMFailure()
- func (d *DiscardStats) LogGCMPush()
- func (d *DiscardStats) LogGoroutines(int)
- func (d *DiscardStats) LogInvalidJSON()
- func (d *DiscardStats) LogLongpollConnect()
- func (d *DiscardStats) LogLongpollDisconnect()
- func (d *DiscardStats) LogPageMessage()
- func (d *DiscardStats) LogPendingRedisActivityCommandsListLength(int)
- func (d *DiscardStats) LogReadMessage()
- func (d *DiscardStats) LogStartup()
- func (d *DiscardStats) LogUserMessage()
- func (d *DiscardStats) LogWebsocketConnection()
- func (d *DiscardStats) LogWebsocketDisconnection()
- func (d *DiscardStats) LogWriteMessage()
- type GCMClient
- type MemoryStore
- func (this *MemoryStore) Client(UID string) (map[string]*Socket, error)
- func (this *MemoryStore) Clients() map[string]map[string]*Socket
- func (this *MemoryStore) Count() (int64, error)
- func (this *MemoryStore) Remove(sock *Socket) error
- func (this *MemoryStore) Save(sock *Socket) error
- func (this *MemoryStore) SetPage(sock *Socket) error
- func (this *MemoryStore) UnsetPage(sock *Socket) error
- type Message
- type RedisCallback
- type RedisCommand
- type RedisCommandResult
- type RedisQueue
- type RedisQueueConsumer
- type RedisStore
- func (this *RedisStore) ActivateLongpollKillswitch(seconds int64) error
- func (this *RedisStore) Clients() ([]string, error)
- func (this *RedisStore) CloseConn(conn redis.Conn)
- func (this *RedisStore) Count() (int64, error)
- func (this *RedisStore) DeactivateLongpollKillswitch() error
- func (this *RedisStore) GetConn() (redis.Conn, error)
- func (this *RedisStore) GetIsLongpollKillswitchActive() (bool, error)
- func (this *RedisStore) MarkActive(user, socket_id string, timestamp int64) error
- func (this *RedisStore) MarkInactive(user, socket_id string) error
- func (this *RedisStore) Poll(c chan []byte, queue string) error
- func (this *RedisStore) Publish(channel string, message string)
- func (this *RedisStore) Push(queue string, message string)
- func (this *RedisStore) QueryIsUserActive(user string, nowTimestamp int64) (bool, error)
- func (this *RedisStore) Remove(sock *Socket) error
- func (this *RedisStore) Save(sock *Socket) error
- func (this *RedisStore) SetPage(sock *Socket) error
- func (this *RedisStore) Subscribe(c chan []byte, channel string) (redis.Conn, error)
- func (this *RedisStore) UnsetPage(sock *Socket) error
- type RuntimeStats
- type Server
- func (this *Server) GetAPNSClient(build string) apns.APNSClient
- func (this *Server) GetGCMClient() GCMClient
- func (this *Server) ListenForHTTPPings()
- func (this *Server) ListenFromLongpoll()
- func (this *Server) ListenFromRedis()
- func (this *Server) ListenFromSockets()
- func (this *Server) LogConnectedClientsPeriodically(period time.Duration)
- func (this *Server) MonitorLongpollKillswitch()
- func (this *Server) RecordStats(period time.Duration)
- func (this *Server) SendHeartbeatsPeriodically(period time.Duration)
- type Socket
- type Storage
- func (this *Storage) Client(UID string) (map[string]*Socket, error)
- func (this *Storage) ClientList() ([]string, error)
- func (this *Storage) Clients() map[string]map[string]*Socket
- func (this *Storage) Count() (int64, error)
- func (this *Storage) Remove(sock *Socket) error
- func (this *Storage) Save(sock *Socket) error
- func (this *Storage) SetPage(sock *Socket) error
- func (this *Storage) UnsetPage(sock *Socket) error
Constants ¶
View Source
const ClientsKey = "SocketClients"
View Source
const PageKey = "PageClients"
View Source
const PresenceKeyPrefix = "ClientPresence"
Variables ¶
View Source
var ( DEBUG bool = false CLIENT_BROAD bool = false )
Functions ¶
func ConfigOption ¶
Types ¶
type CommandMsg ¶
type CommandMsg struct { Command map[string]string `json:"command"` Message map[string]interface{} `json:"message,omitempty"` }
func (*CommandMsg) FromRedis ¶
func (this *CommandMsg) FromRedis(server *Server)
func (*CommandMsg) FromSocket ¶
func (this *CommandMsg) FromSocket(sock *Socket)
type DatadogStats ¶
type DatadogStats struct {
// contains filtered or unexported fields
}
func NewDatadogStats ¶
func NewDatadogStats(datadogHost string) (*DatadogStats, error)
func (*DatadogStats) LogAPNSError ¶
func (d *DatadogStats) LogAPNSError()
func (*DatadogStats) LogAPNSPush ¶
func (d *DatadogStats) LogAPNSPush()
func (*DatadogStats) LogBroadcastMessage ¶
func (d *DatadogStats) LogBroadcastMessage()
func (*DatadogStats) LogClientCount ¶
func (d *DatadogStats) LogClientCount(clients int64)
func (*DatadogStats) LogCommand ¶
func (d *DatadogStats) LogCommand(from, cmdType string)
func (*DatadogStats) LogGCMError ¶
func (d *DatadogStats) LogGCMError()
func (*DatadogStats) LogGCMFailure ¶
func (d *DatadogStats) LogGCMFailure()
func (*DatadogStats) LogGCMPush ¶
func (d *DatadogStats) LogGCMPush()
func (*DatadogStats) LogGoroutines ¶
func (d *DatadogStats) LogGoroutines(goroutines int)
func (*DatadogStats) LogInvalidJSON ¶
func (d *DatadogStats) LogInvalidJSON()
func (*DatadogStats) LogLongpollConnect ¶
func (d *DatadogStats) LogLongpollConnect()
func (*DatadogStats) LogLongpollDisconnect ¶
func (d *DatadogStats) LogLongpollDisconnect()
func (*DatadogStats) LogPageMessage ¶
func (d *DatadogStats) LogPageMessage()
func (*DatadogStats) LogPendingRedisActivityCommandsListLength ¶
func (d *DatadogStats) LogPendingRedisActivityCommandsListLength(length int)
func (*DatadogStats) LogReadMessage ¶
func (d *DatadogStats) LogReadMessage()
func (*DatadogStats) LogStartup ¶
func (d *DatadogStats) LogStartup()
func (*DatadogStats) LogUserMessage ¶
func (d *DatadogStats) LogUserMessage()
func (*DatadogStats) LogWebsocketConnection ¶
func (d *DatadogStats) LogWebsocketConnection()
func (*DatadogStats) LogWebsocketDisconnection ¶
func (d *DatadogStats) LogWebsocketDisconnection()
func (*DatadogStats) LogWriteMessage ¶
func (d *DatadogStats) LogWriteMessage()
type DiscardStats ¶
type DiscardStats struct{}
func (*DiscardStats) LogAPNSError ¶
func (d *DiscardStats) LogAPNSError()
func (*DiscardStats) LogAPNSPush ¶
func (d *DiscardStats) LogAPNSPush()
func (*DiscardStats) LogBroadcastMessage ¶
func (d *DiscardStats) LogBroadcastMessage()
func (*DiscardStats) LogClientCount ¶
func (d *DiscardStats) LogClientCount(int64)
func (*DiscardStats) LogCommand ¶
func (d *DiscardStats) LogCommand(from, cmdType string)
func (*DiscardStats) LogGCMError ¶
func (d *DiscardStats) LogGCMError()
func (*DiscardStats) LogGCMFailure ¶
func (d *DiscardStats) LogGCMFailure()
func (*DiscardStats) LogGCMPush ¶
func (d *DiscardStats) LogGCMPush()
func (*DiscardStats) LogGoroutines ¶
func (d *DiscardStats) LogGoroutines(int)
func (*DiscardStats) LogInvalidJSON ¶
func (d *DiscardStats) LogInvalidJSON()
func (*DiscardStats) LogLongpollConnect ¶
func (d *DiscardStats) LogLongpollConnect()
func (*DiscardStats) LogLongpollDisconnect ¶
func (d *DiscardStats) LogLongpollDisconnect()
func (*DiscardStats) LogPageMessage ¶
func (d *DiscardStats) LogPageMessage()
func (*DiscardStats) LogPendingRedisActivityCommandsListLength ¶
func (d *DiscardStats) LogPendingRedisActivityCommandsListLength(int)
func (*DiscardStats) LogReadMessage ¶
func (d *DiscardStats) LogReadMessage()
func (*DiscardStats) LogStartup ¶
func (d *DiscardStats) LogStartup()
func (*DiscardStats) LogUserMessage ¶
func (d *DiscardStats) LogUserMessage()
func (*DiscardStats) LogWebsocketConnection ¶
func (d *DiscardStats) LogWebsocketConnection()
func (*DiscardStats) LogWebsocketDisconnection ¶
func (d *DiscardStats) LogWebsocketDisconnection()
func (*DiscardStats) LogWriteMessage ¶
func (d *DiscardStats) LogWriteMessage()
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) 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 RedisCallback ¶
type RedisCommand ¶
type RedisCommand struct { Callback RedisCallback Result chan RedisCommandResult }
type RedisCommandResult ¶
type RedisCommandResult struct { Error error Value interface{} }
type RedisQueue ¶
type RedisQueue struct {
// contains filtered or unexported fields
}
A queue of redis commands
func NewRedisQueue ¶
func NewRedisQueue(consumers int, stats RuntimeStats, pool *redisPool) *RedisQueue
func (*RedisQueue) DispatchForever ¶
func (r *RedisQueue) DispatchForever()
Dispatch a command to a goroutine that is blocking on receiving a command.
func (*RedisQueue) ReceiveForever ¶
func (r *RedisQueue) ReceiveForever()
Receive a command, save/enqueue it, and wake the dispatching goroutine
func (*RedisQueue) RunAsyncTimeout ¶
func (r *RedisQueue) RunAsyncTimeout(timeout time.Duration, callback RedisCallback) RedisCommandResult
type RedisQueueConsumer ¶
type RedisQueueConsumer struct {
// contains filtered or unexported fields
}
func NewRedisQueueConsumer ¶
func NewRedisQueueConsumer(commands <-chan RedisCommand, pool *redisPool) *RedisQueueConsumer
func (*RedisQueueConsumer) ConsumeForever ¶
func (r *RedisQueueConsumer) ConsumeForever()
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
func (*RedisStore) ActivateLongpollKillswitch ¶
func (this *RedisStore) ActivateLongpollKillswitch(seconds int64) error
func (*RedisStore) Clients ¶
func (this *RedisStore) Clients() ([]string, error)
func (*RedisStore) CloseConn ¶
func (this *RedisStore) CloseConn(conn redis.Conn)
func (*RedisStore) Count ¶
func (this *RedisStore) Count() (int64, error)
func (*RedisStore) DeactivateLongpollKillswitch ¶
func (this *RedisStore) DeactivateLongpollKillswitch() error
func (*RedisStore) GetIsLongpollKillswitchActive ¶
func (this *RedisStore) GetIsLongpollKillswitchActive() (bool, error)
func (*RedisStore) MarkActive ¶
func (this *RedisStore) MarkActive(user, socket_id string, timestamp int64) error
func (*RedisStore) MarkInactive ¶
func (this *RedisStore) MarkInactive(user, socket_id string) error
func (*RedisStore) Publish ¶
func (this *RedisStore) Publish(channel string, message string)
func (*RedisStore) Push ¶
func (this *RedisStore) Push(queue string, message string)
func (*RedisStore) QueryIsUserActive ¶
func (this *RedisStore) QueryIsUserActive(user string, nowTimestamp int64) (bool, error)
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) UnsetPage ¶
func (this *RedisStore) UnsetPage(sock *Socket) error
type RuntimeStats ¶
type RuntimeStats interface { LogStartup() LogClientCount(int64) LogGoroutines(int) LogCommand(from, cmdType string) LogPageMessage() LogUserMessage() LogBroadcastMessage() LogReadMessage() LogWriteMessage() LogInvalidJSON() LogWebsocketConnection() LogWebsocketDisconnection() LogLongpollConnect() LogLongpollDisconnect() LogAPNSPush() LogAPNSError() LogGCMPush() LogGCMError() LogGCMFailure() LogPendingRedisActivityCommandsListLength(int) }
type Server ¶
type Server struct { ID string Store *Storage Stats RuntimeStats // contains filtered or unexported fields }
func NewServer ¶
func NewServer(store *Storage, stats RuntimeStats) *Server
func (*Server) GetAPNSClient ¶
func (this *Server) GetAPNSClient(build string) apns.APNSClient
func (*Server) GetGCMClient ¶
func (*Server) ListenForHTTPPings ¶
func (this *Server) ListenForHTTPPings()
func (*Server) ListenFromLongpoll ¶
func (this *Server) ListenFromLongpoll()
func (*Server) ListenFromRedis ¶
func (this *Server) ListenFromRedis()
func (*Server) ListenFromSockets ¶
func (this *Server) ListenFromSockets()
func (*Server) LogConnectedClientsPeriodically ¶
func (*Server) MonitorLongpollKillswitch ¶
func (this *Server) MonitorLongpollKillswitch()
func (*Server) RecordStats ¶
func (*Server) SendHeartbeatsPeriodically ¶
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 // contains filtered or unexported fields }
func (*Socket) Authenticate ¶
type Storage ¶
type Storage struct { StorageType string // contains filtered or unexported fields }
func NewStore ¶
func NewStore(stats RuntimeStats) *Storage
func (*Storage) ClientList ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.