Documentation ¶
Overview ¶
Package hub provides messages' routing and processing logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNickCollision = errors.New("Nickname is occupied! Please choose another one...")
ErrNickCollision is returned by Hub.RegisterClient() if connecting client wants to have the nickname that is already occupied.
Functions ¶
func DefaultNameChecker ¶
DefaultNameChecker is a sample NameChecker which strips out HTML and leading/trailing spaces.
Types ¶
type ClientAcceptor ¶
type ClientAcceptor interface { // RegisterClient adds the client with given nickname // to the hub and starts processing its messages. RegisterClient(client.Client, string) error }
ClientAcceptor registers clients and routes messages between them.
type Hub ¶
type Hub interface { ClientAcceptor // Run starts the hub's messaging pump. Run() }
Hub routes messages between clients and controls the clients connected to it.
type NameChecker ¶
NameChecker validates the users' nicknames. Should return transformed nickname and error if client should be refused to join.
Click to show internal directories.
Click to hide internal directories.