domain

package
v0.0.0-...-9fe59c7 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: MIT Imports: 9 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 {
	// contains filtered or unexported fields
}

func MakeClient

func MakeClient(conn *websocket.Conn) *Client

func (*Client) Connect

func (c *Client) Connect()

func (*Client) Disconnect

func (c *Client) Disconnect()

Unregister self from the hub and close websocket connection.

func (*Client) ReceiveLoop

func (c *Client) ReceiveLoop()

hub messages -> client

func (*Client) SelectHub

func (c *Client) SelectHub(hub *Hub)

func (*Client) SendLoop

func (c *Client) SendLoop()

client messages -> hub Note(Appy): This is a potential place we can parse the message I guess?

type Conf

type Conf struct {
	Port uint
	Root string
}

func GetCliOptions

func GetCliOptions() *Conf

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

func MakeHub

func MakeHub() *Hub

Creates a new empty hub

func (*Hub) AddClient

func (h *Hub) AddClient(client *Client)

Adds a client to the hub.

func (*Hub) BroadcastMessage

func (h *Hub) BroadcastMessage(message string)

func (*Hub) BroadcastToClient

func (h *Hub) BroadcastToClient(payload []byte, targetUserID string)

func (*Hub) DeleteClient

func (h *Hub) DeleteClient(client *Client)

Removes the client from the hub.

func (*Hub) HandleCommand

func (h *Hub) HandleCommand(cmd string)

func (*Hub) HandleMessage

func (h *Hub) HandleMessage(message string)

func (*Hub) RegisterClient

func (h *Hub) RegisterClient(client *Client)

Registers the client by sending the client into the register channel.

func (*Hub) Run

func (h *Hub) Run()

func (*Hub) UnregisterClient

func (h *Hub) UnregisterClient(client *Client)

Unregisters the client by sending the client into the unregister channel

Jump to

Keyboard shortcuts

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