Documentation ¶
Overview ¶
Package handler contains the TCP (Telnet) and Websocket handling as well as providing the static files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Broadcaster ¶
type Broadcaster struct {
// contains filtered or unexported fields
}
The Broadcaster waits for messages on a channel. It will iterate over all connected clients and sends the messages to their input channels.
func NewBroadcaster ¶
func NewBroadcaster(message chan *model.Message) *Broadcaster
NewBroadcaster creates a Broadcaster.
func (*Broadcaster) Start ¶
func (b *Broadcaster) Start()
Start should be used as goroutine and starts the application broadcaster.
type SocketIOWrapper ¶
type SocketIOWrapper struct {
// contains filtered or unexported fields
}
SocketIOWrapper wraps the client and room list as well as the broadcaster channel for the Websocket server.
func NewSocketIOWrapper ¶
func NewSocketIOWrapper(clientList *model.ClientList, roomList *model.RoomList, broadcast chan *model.Message) *SocketIOWrapper
NewSocketIOWrapper creates a SocketIOWrapper.
func (*SocketIOWrapper) OnSocketChat ¶
func (s *SocketIOWrapper) OnSocketChat(ns *socketio.NameSpace, input SocketInput)
OnSocketChat handles all chat commands and messages from the client. It takes care of registration and command delegation.
func (*SocketIOWrapper) OnSocketConnect ¶
func (s *SocketIOWrapper) OnSocketConnect(ns *socketio.NameSpace)
OnSocketConnect handles connect messages sent from client.
func (*SocketIOWrapper) OnSocketDisconnect ¶
func (s *SocketIOWrapper) OnSocketDisconnect(ns *socketio.NameSpace)
OnSocketConnect handles disconnect messages sent from client. It will take care of unexpectedly disconnected clients (e.g. tab close).
type SocketInput ¶
SocketInput represents a JSON request from the client.
type TcpServerWrapper ¶
type TcpServerWrapper struct {
// contains filtered or unexported fields
}
TcpServerWrapper wraps the client and room list as well as the broadcaster channel for the TCP (Telnet) server.
func NewTcpServerWrapper ¶
func NewTcpServerWrapper(clientList *model.ClientList, roomList *model.RoomList, broadcast chan *model.Message) *TcpServerWrapper
NewTcpServerWrapper creates a TcpServerWrapper.
func (*TcpServerWrapper) Start ¶
func (tsw *TcpServerWrapper) Start()
Start should be used as goroutine and starts the TCP (Telnet) server.