Documentation ¶
Index ¶
- type AllMembers
- type Connector
- type ConnectorRemote
- type JoinResponse
- type NewUser
- type RPCResponse
- type Response
- type Room
- func (r *Room) AfterInit()
- func (r *Room) Entry(ctx context.Context, msg []byte) (*JoinResponse, error)
- func (r *Room) GetSessionData(ctx context.Context) (*SessionData, error)
- func (r *Room) Init()
- func (r *Room) Join(ctx context.Context) (*JoinResponse, error)
- func (r *Room) Message(ctx context.Context, msg *UserMessage)
- func (r *Room) MessageRemote(ctx context.Context, msg *UserMessage, b bool, s string) (*UserMessage, error)
- func (r *Room) SendRPC(ctx context.Context, msg *SendRPCMsg) (*protos.RPCRes, error)
- func (r *Room) SetSessionData(ctx context.Context, data *SessionData) ([]byte, error)
- type SendRPCMsg
- type SessionData
- type Stats
- type UserMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllMembers ¶
type AllMembers struct {
Members []string `json:"members"`
}
AllMembers contains all members uid
type Connector ¶
Connector struct
func (*Connector) GetSessionData ¶
func (c *Connector) GetSessionData(ctx context.Context) (*SessionData, error)
GetSessionData gets the session data
func (*Connector) NotifySessionData ¶
func (c *Connector) NotifySessionData(ctx context.Context, data *SessionData)
NotifySessionData sets the session data
func (*Connector) SetSessionData ¶
SetSessionData sets the session data
type ConnectorRemote ¶
ConnectorRemote is a remote that will receive rpc's
func (*ConnectorRemote) RemoteFunc ¶
func (c *ConnectorRemote) RemoteFunc(ctx context.Context, msg *protos.RPCMsg) (*protos.RPCRes, error)
RemoteFunc is a function that will be called remotely
type JoinResponse ¶
JoinResponse represents the result of joining room
type NewUser ¶
type NewUser struct {
Content string `json:"content"`
}
NewUser message will be received when new user join room
type RPCResponse ¶
type RPCResponse struct {
Msg string `json:"msg"`
}
RPCResponse represents a rpc message
type Room ¶
Room represents a component that contains a bundle of room related handler like Join/Message
func (*Room) GetSessionData ¶
func (r *Room) GetSessionData(ctx context.Context) (*SessionData, error)
GetSessionData gets the session data
func (*Room) Message ¶
func (r *Room) Message(ctx context.Context, msg *UserMessage)
Message sync last message to all members
func (*Room) MessageRemote ¶
func (r *Room) MessageRemote(ctx context.Context, msg *UserMessage, b bool, s string) (*UserMessage, error)
MessageRemote just echoes the given message
func (*Room) SetSessionData ¶
SetSessionData sets the session data
type SendRPCMsg ¶
type SendRPCMsg struct { ServerID string `json:"serverId"` Route string `json:"route"` Msg string `json:"msg"` }
SendRPCMsg represents a rpc message
type Stats ¶
type Stats struct {
// contains filtered or unexported fields
}
Stats exports the room status
type UserMessage ¶
UserMessage represents a message that user sent