Documentation
¶
Overview ¶
Package queqiao 实现 QueQiao WebSocket 协议。
Index ¶
- Constants
- type Bridge
- func (b *Bridge) Broadcast(text string) error
- func (b *Bridge) Config() Config
- func (b *Bridge) Connected() bool
- func (b *Bridge) Rcon(command string) error
- func (b *Bridge) RconResponse(ctx context.Context, command string) (string, error)
- func (b *Bridge) Run(ctx context.Context)
- func (b *Bridge) Send(api string, data interface{}) error
- func (b *Bridge) Stop()
- func (b *Bridge) Tell(name, text string) error
- type Client
- func (c *Client) Broadcast(text string) error
- func (c *Client) Close() error
- func (c *Client) Config() Config
- func (c *Client) Connect(ctx context.Context) error
- func (c *Client) Connected() bool
- func (c *Client) Rcon(command string) error
- func (c *Client) RconResponse(ctx context.Context, command string) (string, error)
- func (c *Client) Read() (Incoming, error)
- func (c *Client) Send(api string, data interface{}) error
- func (c *Client) SendAndWait(ctx context.Context, api string, data interface{}) (Incoming, error)
- func (c *Client) Tell(nickname, text string) error
- type Config
- type Incoming
- type Player
Constants ¶
View Source
const ( ActionBroadcast = "broadcast" ActionPrivateMessage = "send_private_msg" ActionTitle = "send_title" ActionActionBar = "send_actionbar" ActionRconCommand = "send_rcon_command" ActionGetStatus = "get_status" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
func (*Bridge) RconResponse ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 允许一个读取者和多个并发写入者。
func (*Client) RconResponse ¶
func (*Client) SendAndWait ¶
type Incoming ¶
type Incoming struct {
PostType string `json:"post_type"`
EventName string `json:"event_name"`
SubType string `json:"sub_type"`
ServerName string `json:"server_name"`
Timestamp int64 `json:"timestamp"`
Player Player `json:"player"`
RawMessage string `json:"raw_message"`
Message string `json:"message"`
Command string `json:"command"`
Death *struct {
Text string `json:"text"`
Key string `json:"key"`
} `json:"death,omitempty"`
Achievement *struct {
Text string `json:"text"`
Key string `json:"key"`
} `json:"achievement,omitempty"`
API string `json:"api"`
Status string `json:"status"`
Code int `json:"code"`
Echo string `json:"echo,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
}
Incoming 是 QueQiao 事件和 API 响应共用的帧结构。
func (Incoming) IsResponse ¶
Click to show internal directories.
Click to hide internal directories.