hub

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Upgrader = websocket.Upgrader{
	ReadBufferSize:  1024,
	WriteBufferSize: 1024,
}

Functions

This section is empty.

Types

type Client

type Client struct {
	UserId int32
	Conn   *websocket.Conn
	Hub    *Hub
	Send   chan []byte
}

func (*Client) ReadPump

func (c *Client) ReadPump()

func (*Client) Write

func (c *Client) Write(mt int, payload []byte) error

func (*Client) WritePump

func (c *Client) WritePump()

type Hub

type Hub struct {
	sync.RWMutex
	Clients    map[int32]map[*Client]bool
	Broadcast  chan []byte
	Register   chan *Client
	Unregister chan *Client
}

func NewHub

func NewHub() *Hub

func (*Hub) GetUserConnectionsByUserId

func (h *Hub) GetUserConnectionsByUserId(userId int32) map[*Client]bool

func (*Hub) Run

func (h *Hub) Run(ctx context.Context)

Jump to

Keyboard shortcuts

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