Documentation
¶
Index ¶
- Constants
- type ChatServer
- type Client
- type Message
- type TempChat
- func (TempChat) CaddyModule() caddy.ModuleInfo
- func (p *TempChat) Cleanup() error
- func (p *TempChat) Provision(ctx caddy.Context) error
- func (p *TempChat) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhttp.Handler) error
- func (p *TempChat) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (p *TempChat) Validate() error
Constants ¶
View Source
const ( MsgTypeOnline = "online" MsgTypeOffline = "offline" MsgTypeChat = "chat" MsgTypeSystem = "system" )
Message type constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatServer ¶
type ChatServer struct {
// contains filtered or unexported fields
}
ChatServer maintains the set of active clients and broadcasts messages to all clients
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a connected user
type Message ¶
type Message struct {
Type string `json:"type"`
Content string `json:"content,omitempty"`
Username string `json:"username,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
OnlineNum int `json:"online_num"`
}
Message structure
type TempChat ¶
type TempChat struct {
// contains filtered or unexported fields
}
func (TempChat) CaddyModule ¶
func (TempChat) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*TempChat) UnmarshalCaddyfile ¶
UnmarshalCaddyfile implements caddyfile.Unmarshaler.
Click to show internal directories.
Click to hide internal directories.