ws

package
v0.0.0-...-fa8c592 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 5 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 {
	//User id for client
	Id string
	// contains filtered or unexported fields
}

Client is a middleman between the websocket connection and the hub.

type Emitter

type Emitter struct {
	Ids     []string
	Message []byte
}

type Hub

type Hub struct {

	// Emit message for particular client
	Emit chan *Emitter
	// contains filtered or unexported fields
}

hub maintains the set of active clients and broadcasts messages to the clients.

func NewHub

func NewHub() *Hub

func (*Hub) GetClientCount

func (h *Hub) GetClientCount() int

func (*Hub) Run

func (h *Hub) Run()

type WebSocket

type WebSocket struct {
	Hub *Hub
}

func (*WebSocket) ServeWs

func (websocket *WebSocket) ServeWs(w http.ResponseWriter, r *http.Request)

serveWs handles websocket requests from the peer.

Jump to

Keyboard shortcuts

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