Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { ID string `json:"id"` Username string `json:"username"` ConnectedAt time.Time `json:"connected_at"` }
Client contains all fields required for pigeon.
type Message ¶
type Message struct { ID string `json:"id"` Client Client `json:"client"` Message string `json:"message"` Connected bool `json:"connected"` Timestamp time.Time `json:"timestamp"` }
Message contains all fields required to send a message with pigeon.
type Pigeon ¶
type Pigeon struct { Clients map[*websocket.Conn]Client Broadcast chan Message BroadcastHistory []Message Register chan *websocket.Conn Unregister chan *websocket.Conn Server *http.Server Upgrader *websocket.Upgrader OnionURL string RemotePort int TorVersion3 bool Logger *log.Logger Debug bool }
Pigeon is the object that stores all clients, messages, and configuration options.
func (*Pigeon) BroadcastMessages ¶
func (p *Pigeon) BroadcastMessages()
BroadcastMessages continuously loops and checks if it needs to add a new client, remove a current client, or broadcast any message received from a client to all other clients.
Click to show internal directories.
Click to hide internal directories.