Documentation
¶
Index ¶
- Constants
- type Bucket
- type Command
- type CommandJoinData
- type CommandLeaveData
- type Job
- type Manager
- func (m *Manager) AddSession(session *WSSession)
- func (m *Manager) BucketBySessionID(sessionID string) *Bucket
- func (m *Manager) DeleteSession(session *WSSession)
- func (m *Manager) JoinRoom(roomID string, session *WSSession)
- func (m *Manager) LeaveRoom(roomID string, session *WSSession)
- func (m *Manager) Push(sessionID string, command *Command)
- func (m *Manager) PushAll(command *Command)
- func (m *Manager) PushRoom(roomID string, command *Command)
- func (m *Manager) SetGatewayAddr(gatewayAddr string)
- func (m *Manager) Status() *Status
- type Room
- type Status
- type WSMessage
- type WSSession
Constants ¶
View Source
const ( OP_PUSH = 1 OP_PUSH_ROOM = 2 // push to memebers in a room OP_PUSH_ALL = 3 // push to all online members )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { RequestID string `json:"req_id"` OP string `json:"op"` Data json.RawMessage `json:"data"` }
func CreateCommand ¶
func (*Command) ToWSMessage ¶
type CommandJoinData ¶
type CommandJoinData struct {
RoomID string `json:"room_id"`
}
type CommandLeaveData ¶
type CommandLeaveData struct {
RoomID string `json:"room_id"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager() *Manager
func (*Manager) AddSession ¶
func (*Manager) BucketBySessionID ¶
func (*Manager) DeleteSession ¶
func (*Manager) SetGatewayAddr ¶
type Status ¶
type Status struct {
OnlinePeople int64
}
func (*Status) DecreaseOnlinePeople ¶
func (s *Status) DecreaseOnlinePeople()
func (*Status) IncreaseOnlinePeople ¶
func (s *Status) IncreaseOnlinePeople()
type WSSession ¶
type WSSession struct { ID string // contains filtered or unexported fields }
func NewWSSession ¶
func NewWSSession(id string, claims identity.Claims, conn *websocket.Conn, manager *Manager, dispatcherClient dispatcherProto.DispatcherServiceClient, routerClient routerProto.RouterServiceClient, roomID string) *WSSession
func (*WSSession) Close ¶
func (s *WSSession) Close()
Close func which closes websocket session and remove session from bucket and room.
func (*WSSession) ReadMessage ¶
func (*WSSession) SendCommand ¶
func (*WSSession) SendMessage ¶
func (*WSSession) StartTasks ¶
func (s *WSSession) StartTasks()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.