server

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Websocks []*Websock
)

Functions

This section is empty.

Types

type Ping

type Ping struct {
}

Ping is a full fledged Request handler, You can write your own!

func (Ping) ServeHTTP

func (p Ping) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP will respond to the writer with 'Pong'

type Server

type Server struct {
	*http.Server       `json:"-"`
	*http.ServeMux     `json:"-"`
	*template.Template `json:"-"`

	EndPoints sync.Map `json:"routes"`
}

Server serves up HTTP on Addr (default 0.0.0.0:8011) It takes care of REST API, serving the web app if Appdir does not equal nil and initial Websocket upgrade

func GetServer

func GetServer() *Server

func NewServer

func NewServer() *Server

func (*Server) Appdir

func (s *Server) Appdir(path, file string)

func (*Server) EmbedTempl

func (s *Server) EmbedTempl(path string, fsys embed.FS, data any)

func (*Server) EndPointCount

func (s *Server) EndPointCount() int

func (*Server) Register

func (s *Server) Register(p string, h http.Handler) error

Register to handle HTTP requests for particular paths in the URL or MQTT channel.

func (Server) ServeHTTP

func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) Start

func (s *Server) Start(done chan any)

Start the HTTP server after registering REST API callbacks and initializing the Web application directory

type WServe

type WServe struct {
}

func (WServe) ServeHTTP

func (ws WServe) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Websock

type Websock struct {
	*websocket.Conn

	Done chan any
	// contains filtered or unexported fields
}

func NewWebsock

func NewWebsock(conn *websocket.Conn) *Websock

func (*Websock) GetWriteQ

func (ws *Websock) GetWriteQ() chan *messanger.Msg

Jump to

Keyboard shortcuts

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