ws

package
v0.0.0-...-7fff55e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Conn     *websocket.Conn
	ClientId string `json:"clientId"`
	Username string `json:"username"`
	RoomId   string `json:"roomId"`
	Message  chan *Message
}

func (*Client) ReadMessage

func (c *Client) ReadMessage(h *Hub)

func (*Client) WriteMessage

func (c *Client) WriteMessage()

type Hub

type Hub struct {
	Broadcast  chan *Message
	Register   chan *Client
	Unregister chan *Client
	Rooms      map[string]*Room
}

func NewHub

func NewHub() *Hub

func (*Hub) Run

func (h *Hub) Run()

type Message

type Message struct {
	Message  string `json:"message"`
	ClientId string `json:"clientId"`
	RoomId   string `json:"roomId"`
	Username string `json:"username"`
}

type Room

type Room struct {
	RoomId   string             `json:"roomId"`
	RoomName string             `json:"roomName"`
	Clients  map[string]*Client `json:"clients"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL