websocket

package
v0.0.0-...-46c0cbc Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reader

func Reader(conn *websocket.Conn)

func Upgrade

func Upgrade(w http.ResponseWriter, r *http.Request) (*websocket.Conn, error)

func Writer

func Writer(conn *websocket.Conn)

Types

type Client

type Client struct {
	ID   string
	Conn *websocket.Conn
	Pool *Pool
}

func (*Client) Read

func (c *Client) Read()

type Message

type Message struct {
	Type int    `json:"type"`
	Body string `json:"body"`
}

type Pool

type Pool struct {
	Register   chan *Client
	Unregister chan *Client
	Clients    map[*Client]bool
	Broadcast  chan Message
}

func NewPool

func NewPool() *Pool

func (*Pool) Start

func (pool *Pool) Start()

Jump to

Keyboard shortcuts

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