wshub

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PubAckOK     = "ok"
	PubAckFailed = "failed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Hub

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

func New

func New() *Hub

func (*Hub) CloseSession

func (h *Hub) CloseSession(sessionID string)

func (*Hub) Publish

func (h *Hub) Publish(id string, data []byte)

func (*Hub) RegisterSession

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

func (*Hub) Run

func (h *Hub) Run(registerFunc, unregisterFunc func(id string))

func (*Hub) Subscribe

func (h *Hub) Subscribe() <-chan Message

type Message

type Message struct {
	ID   string // session id
	Data []byte
}

type Session

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

Jump to

Keyboard shortcuts

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