websocket

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Upgrade

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

Types

type Client

type Client struct {
	ID   int
	Conn *websocket.Conn
	Pool *Pool
	// contains filtered or unexported fields
}

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 []byte
}

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