server

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateID

func GenerateID() string

func GetClient

func GetClient(id string) *websocket.Conn

func PortsToRangeString

func PortsToRangeString(ports []string) string

func Register

func Register(req *http.Request, socket *websocket.Conn) string

Register client by using the HTTP request with `?client_id=abc`

func WaitForClient

func WaitForClient(id string, timeout time.Duration) (*websocket.Conn, error)

Wait for client with id to connect

func WebsocketHandler

func WebsocketHandler(w http.ResponseWriter, req *http.Request)

HTTP handler for WebSocket server

Types

type Server

type Server struct {
	Host      string
	Ports     []string
	Handler   http.Handler
	Listeners map[string]*http.Server
	ErrorLog  *log.Logger
	InfoLog   *log.Logger
}

func Create

func Create(handler http.Handler, host string, ports ...string) *Server

func (*Server) ListenAndServer

func (server *Server) ListenAndServer()

func (*Server) Shutdown

func (server *Server) Shutdown(ctx context.Context) error

Directories

Path Synopsis
http module

Jump to

Keyboard shortcuts

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