starlight

package module
v0.0.0-...-836bb9a Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 9 Imported by: 0

README

Starlight

Full-duplex real-time web protocol

Documentation

Index

Constants

View Source
const PROTOCOL_VERSION = 1

Variables

View Source
var NotFoundHandler = http.HandlerFunc(handleNotFound)

Functions

This section is empty.

Types

type Protocol

type Protocol uint16
const (
	PROTOCOL_poll01 Protocol = 10 // poll01
	PROTOCOL_lpll01 Protocol = 11 // lpll01
	PROTOCOL_hsse01 Protocol = 12 // hsse01
	PROTOCOL_webs01 Protocol = 13 // webs01
)

func (Protocol) String

func (i Protocol) String() string

type Starlight

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

func NewStarlight

func NewStarlight(options ...StarlightOption) *Starlight

func (*Starlight) ServeHTTP

func (g *Starlight) ServeHTTP(w http.ResponseWriter, r *http.Request)

type StarlightConfig

type StarlightConfig struct {
	AllowPoll      bool // poll01
	AllowLongPoll  bool // lpll01
	AllowSSE       bool // hsse01
	AllowWebsocket bool // webs01

	SessionTimeout       time.Duration
	LongPollTimeout      time.Duration
	HTTPStreamingTimeout time.Duration

	BasePath        string
	DefaultProtocol Protocol

	NotFoundHandler func(w http.ResponseWriter, r *http.Request)
}

type StarlightOption

type StarlightOption func(*StarlightConfig)

func WithAllowLongPoll

func WithAllowLongPoll(allow bool) StarlightOption

func WithAllowPoll

func WithAllowPoll(allow bool) StarlightOption

func WithAllowSSE

func WithAllowSSE(allow bool) StarlightOption

func WithAllowWebsocket

func WithAllowWebsocket(allow bool) StarlightOption

func WithDefaultProtocol

func WithDefaultProtocol(protocol Protocol) StarlightOption

func WithNotFoundHandler

func WithNotFoundHandler(handler func(w http.ResponseWriter, r *http.Request)) StarlightOption

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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