Documentation ¶
Index ¶
- type AllMembers
- type Connector
- type ConnectorRemote
- func (c *ConnectorRemote) Descriptor(ctx context.Context, names *pitayaprotos.ProtoNames) (*pitayaprotos.ProtoDescriptors, error)
- func (c *ConnectorRemote) Docs(ctx context.Context, ddd *pitayaprotos.Doc) (*pitayaprotos.Doc, error)
- func (c *ConnectorRemote) RemoteFunc(ctx context.Context, msg *protos.RPCMsg) (*protos.RPCRes, error)
- type JoinResponse
- type NewUser
- type RPCResponse
- type Response
- type Room
- func (r *Room) AfterInit()
- func (r *Room) Entry(ctx context.Context, msg []byte) (*protos.JoinResponse, error)
- func (r *Room) GetSessionData(ctx context.Context) (*SessionData, error)
- func (r *Room) Init()
- func (r *Room) Join(ctx context.Context) (*protos.JoinResponse, error)
- func (r *Room) Message(ctx context.Context, msg *protos.UserMessage)
- func (r *Room) MessageRemote(ctx context.Context, msg *protos.UserMessage, b bool, s string) (*protos.UserMessage, error)
- func (r *Room) SendRPC(ctx context.Context, msg *protos.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 ¶
func (c *Connector) SetSessionData(ctx context.Context, data *SessionData) (*protos.Response, error)
SetSessionData sets the session data
type ConnectorRemote ¶
ConnectorRemote is a remote that will receive rpc's
func NewConnectorRemote ¶
func NewConnectorRemote(app pitaya.Pitaya) *ConnectorRemote
NewConnectorRemote ctor
func (*ConnectorRemote) Descriptor ¶ added in v2.0.3
func (c *ConnectorRemote) Descriptor(ctx context.Context, names *pitayaprotos.ProtoNames) (*pitayaprotos.ProtoDescriptors, error)
func (*ConnectorRemote) Docs ¶
func (c *ConnectorRemote) Docs(ctx context.Context, ddd *pitayaprotos.Doc) (*pitayaprotos.Doc, error)
Docs returns documentation
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 *protos.UserMessage)
Message sync last message to all members
func (*Room) MessageRemote ¶
func (r *Room) MessageRemote(ctx context.Context, msg *protos.UserMessage, b bool, s string) (*protos.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