Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Timestamp func() string = _timestamp
overwritable for testing
Functions ¶
This section is empty.
Types ¶
type ChatManager ¶
type ChatManager struct {
// contains filtered or unexported fields
}
ChatManager keeps track of clients connected to the chat service and is responsible for communications between them.
func NewChatManager ¶
func NewChatManager(chatLog io.Writer, maxHistoryLines int) *ChatManager
NewChatManager returns an initialized ChatManager
func (*ChatManager) Broadcast ¶
func (c *ChatManager) Broadcast(name string, msg []byte)
Broadcast writes msg to all clients known to the ChatManager.
func (*ChatManager) History ¶
func (c *ChatManager) History(numLines int) []byte
History returns the specifies number of lines (numLines) from the chat history as a slices of bytes.
func (*ChatManager) Join ¶
func (c *ChatManager) Join(name string, conn net.Conn) error
Join adds a user to the chat manager and announces the join to all clients.
func (*ChatManager) Quit ¶
func (c *ChatManager) Quit(name string)
Quit removes a user from the chat manager and announces the quit to all clients.
Click to show internal directories.
Click to hide internal directories.