websocket

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector interface {
	UUID() string
	Headers() http.Header
	Send(v []byte)
	OnClose(cb func(string))
	Close()
}

Connector interface

type Handler

type Handler func([]byte, Connector)

Handler request processor

type Hub

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

func New

func New(handler Handler, log logger.Logger) *Hub

func (*Hub) Add

func (v *Hub) Add(c *connection)

Add connection to hub

func (*Hub) CloseAll

func (v *Hub) CloseAll()

CloseAll close all connection

func (*Hub) Down

func (v *Hub) Down() error

Down hub

func (*Hub) SendAll

func (v *Hub) SendAll(b []byte)

SendAll broadcast send message

func (*Hub) ServeHTTP

func (v *Hub) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP http handler

func (*Hub) Up

func (v *Hub) Up() error

Up hub

Jump to

Keyboard shortcuts

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