Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWebsocketRequired = &api.Error{ Code: 426, Message: "this endpoint requires a web socket connection", } ErrChatAlreadyExists = &api.Error{ Code: 409, Message: "chat already exists", } )
Functions ¶
This section is empty.
Types ¶
type ChatHandler ¶
type ChatHandler struct { Server *Server *users.UserService // contains filtered or unexported fields }
func NewHandler ¶
func NewHandler(s *Server) *ChatHandler
func (*ChatHandler) Route ¶
func (h *ChatHandler) Route(r fiber.Router)
type Client ¶
type Server ¶
type Server struct { // Chats is a map where each chat // room is identified by its UUID. Chats map[uuid.UUID]*Chat // Register channel for new // clients to join a chat room. Register chan *Client // Unregister channel for // clients leaving a chat room. Unregister chan *Client // Broadcast channel for sending messages // to all clients in a chat room. Broadcast chan *Message // contains filtered or unexported fields }
Server struct manages multiple chat rooms and handles client registration, unregistration, and message broadcasting.
Click to show internal directories.
Click to hide internal directories.