hub

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: MIT Imports: 7 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 {
	// contains filtered or unexported fields
}

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

func NewClient

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

NewClient --

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

Hub --

func New

func New(ctx context.Context, databaseChangeNotification chan []byte) *Hub

New --

func (*Hub) Broadcast

func (h *Hub) Broadcast(message []byte)

Broadcast a message

func (*Hub) GetBroadcast

func (h *Hub) GetBroadcast() chan []byte

GetBroadcast --

func (*Hub) Run

func (h *Hub) Run()

Run starts the websocket hub

func (*Hub) WSHandler

func (h *Hub) WSHandler(w http.ResponseWriter, r *http.Request)

WSHandler handles websocket requests from the peer.

type Message

type Message struct {
	Action string `json:"action"`
	Model  string `json:"model,omitempty"`
	ID     int    `json:"id,omitempty"`
}

Message --

Jump to

Keyboard shortcuts

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