Documentation
¶
Index ¶
- Constants
- type Message
- type Room
- type WSServer
- func (ws *WSServer) Broadcast(user, room string, msg []byte)
- func (ws *WSServer) Close()
- func (ws *WSServer) ConnectToRoom(c echo.Context) error
- func (ws *WSServer) GetRoom(c echo.Context) error
- func (ws *WSServer) GracefulDisconnect(room, user string, conn *websocket.Conn)
- func (ws *WSServer) SendError(user string, err error)
- func (ws *WSServer) SubscribeNewUser(room string) uuid.UUID
- func (ws *WSServer) Unsubscribe(id uuid.UUID, room string)
- func (ws *WSServer) WSHandler(c echo.Context) error
Constants ¶
View Source
const ( READSIZE = 1024 WRITESIZE = 1024 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WSServer ¶
type WSServer struct {
Upgrader websocket.Upgrader
Connections map[string]*websocket.Conn
Rooms map[string][]string
}
func NewWSServer ¶
func NewWSServer() *WSServer
func (*WSServer) GracefulDisconnect ¶
func (*WSServer) SendError ¶
SendError is a function that takes a websocket connection and sends an error message
func (*WSServer) SubscribeNewUser ¶
Subscribe returns a unique id for the client to use to subscribe to the websocket
func (*WSServer) Unsubscribe ¶
Unsubscribe removes the client from the list of connections
Click to show internal directories.
Click to hide internal directories.