Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeMessage ¶
func EncodeMessage(msg ControlMessage) []byte
func GetSocketPath ¶
func SendCommand ¶
Types ¶
type ControlMessage ¶
type ControlMessage struct {
Cmd string `json:"cmd"`
App string `json:"app"`
MsgId string `json:"msgId"`
Text string `json:"text"`
Stat AppStat `json:"stat"`
Stats []AppStat `json:"stats"`
Error string `json:"error"`
// `Pid` shall be provided when `Cmd` is `handshake`.
Pid int `json:"pid"`
// `conn.Close()` will destroy the connection before the final message is flushed, causing the
// other peer losing the connection and the message, and no EOF will be received. To guarantee
// the final message is sent, we need a signal (`FIN`) to indicate whether this is the final
// message, and close the connection on the receiver side.
Fin bool `json:"fin"`
}
func DecodeMessage ¶
func DecodeMessage(packet *[]byte, buf []byte, n int, eof bool) []ControlMessage
Click to show internal directories.
Click to hide internal directories.