server

package
v0.0.0-...-c81e07c Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 8 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 {
	ID       string
	Hub      *Hub
	Color    string
	Socket   *websocket.Conn
	Outbound chan []byte
}

func NewClient

func NewClient(hub *Hub, socket *websocket.Conn) *Client

func (Client) Close

func (client Client) Close()

func (*Client) Read

func (client *Client) Read()

func (Client) Run

func (client Client) Run()

func (*Client) Write

func (client *Client) Write()

type Hub

type Hub struct {
	Clients    []*Client
	Register   chan *Client
	Unregister chan *Client
}

func NewHub

func NewHub() *Hub

func (*Hub) Broadcast

func (hub *Hub) Broadcast(message interface{}, ignore *Client)

func (*Hub) HandleWebSocket

func (hub *Hub) HandleWebSocket(w http.ResponseWriter, r *http.Request)

func (*Hub) OnConnect

func (hub *Hub) OnConnect(client *Client)

func (*Hub) OnDisconnect

func (hub *Hub) OnDisconnect(client *Client)

func (*Hub) OnMessage

func (hub *Hub) OnMessage(data []byte, client *Client)

func (*Hub) Run

func (hub *Hub) Run()

func (*Hub) Send

func (hub *Hub) Send(message interface{}, client *Client)

Jump to

Keyboard shortcuts

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