websocket

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package websocket implements bitwire's binary envelope carrier.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

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

Endpoint owns one WebSocket and implements the shared interface directly.

func Accept

func Accept(w http.ResponseWriter, r *http.Request, options Options) (*Endpoint, error)

Accept establishes one endpoint; the caller remains responsible for its HTTP server.

func Dial

func Dial(ctx context.Context, address string, options Options) (*Endpoint, error)

Dial uses normal HTTP/TLS verification. Its context governs establishment only.

func (*Endpoint) Close

func (e *Endpoint) Close() error

func (*Endpoint) Closed

func (e *Endpoint) Closed() <-chan struct{}

func (*Endpoint) Receive

func (e *Endpoint) Receive(handler func(wire.Envelope)) (func(), error)

func (*Endpoint) Send

func (e *Endpoint) Send(envelope wire.Envelope) error

func (*Endpoint) Termination

func (e *Endpoint) Termination() wire.Termination

type Options

type Options struct {
	core.PairOptions
	CloseTimeout     time.Duration
	HandshakeTimeout time.Duration
	HTTPClient       *http.Client
	Header           http.Header
	OriginPatterns   []string
	Authorize        func(*http.Request) bool
	Path             string
}

Options configure host effects and finite resource limits, never service semantics.

type Server

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

Server is an HTTP handler owning its accepted endpoints. Only Listen owns a listener.

func Listen

func Listen(address string, options Options, connected func(*Endpoint, *http.Request)) (*Server, error)

func NewServer

func NewServer(options Options, connected func(*Endpoint, *http.Request)) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) Closed

func (s *Server) Closed() <-chan struct{}

func (*Server) ServeHTTP

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

func (*Server) URL

func (s *Server) URL() string

URL is nonempty only for the convenience listener created by Listen.

Jump to

Keyboard shortcuts

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