Documentation
¶
Index ¶
- type Client
- type ClientInterface
- type ConnectionInterface
- type Hub
- func (h *Hub) BroadcastMessage(message Message)
- func (h *Hub) HandleWebSocketMessage(message Message)
- func (h *Hub) IsTest(isTest bool)
- func (h *Hub) RegisterClient(client ClientInterface)
- func (h *Hub) Run(ctx context.Context, logger Logger)
- func (h *Hub) UnregisterClient(client ClientInterface)
- func (h *Hub) UpgradeWebSocket(c *websocket.Conn, logger Logger)
- type Logger
- type Message
- type TheHub
- type WebSocketConnection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Conn ConnectionInterface Send chan Message Producer kafka.Producer }
func (*Client) GetConnection ¶
func (c *Client) GetConnection() ConnectionInterface
func (*Client) SendMessage ¶
type ClientInterface ¶
type ConnectionInterface ¶
type Hub ¶
type Hub struct { Clients map[ClientInterface]bool Broadcast chan Message Register chan ClientInterface Unregister chan ClientInterface Logger Logger SaramaConfig *sarama.Config // contains filtered or unexported fields }
func (*Hub) BroadcastMessage ¶
func (*Hub) HandleWebSocketMessage ¶
func (*Hub) RegisterClient ¶
func (h *Hub) RegisterClient(client ClientInterface)
func (*Hub) UnregisterClient ¶
func (h *Hub) UnregisterClient(client ClientInterface)
func (*Hub) UpgradeWebSocket ¶
type TheHub ¶
type TheHub interface { Run(ctx context.Context, logger Logger) RegisterClient(client ClientInterface) UnregisterClient(client ClientInterface) BroadcastMessage(message Message) HandleWebSocketMessage(message Message) UpgradeWebSocket(c *websocket.Conn, logger Logger) IsTest(isTest bool) }
type WebSocketConnection ¶
type WebSocketConnection struct {
Conn *websocket.Conn
}
func (*WebSocketConnection) Close ¶
func (wsc *WebSocketConnection) Close() error
func (*WebSocketConnection) ReadMessage ¶
func (wsc *WebSocketConnection) ReadMessage() (int, []byte, error)
func (*WebSocketConnection) WriteMessage ¶
func (wsc *WebSocketConnection) WriteMessage(messageType int, data []byte) error
Click to show internal directories.
Click to hide internal directories.