websocket

package
v0.0.0-...-e62627f Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ModuleName = "websocket"

Variables

This section is empty.

Functions

func InstallGlobal

func InstallGlobal(ctx *quickjs.Context, options ...Option) error

func Module

func Module(options ...Option) module.Definition

Types

type Config

type Config struct {
	Dialer         Dialer
	Headers        http.Header
	Policy         Policy
	ResourceLimits *limits.Runtime
}

type Conn

type Conn interface {
	ReadMessage() (messageType int, data []byte, err error)
	WriteMessage(messageType int, data []byte) error
	Close() error
}

type Dialer

type Dialer interface {
	DialContext(ctx context.Context, urlStr string, requestHeader http.Header) (Conn, *http.Response, error)
}

type DialerFunc

type DialerFunc func(context.Context, string, http.Header) (Conn, *http.Response, error)

func (DialerFunc) DialContext

func (dialer DialerFunc) DialContext(ctx context.Context, urlStr string, requestHeader http.Header) (Conn, *http.Response, error)

type Option

type Option func(*Config)

func WithDialer

func WithDialer(dialer Dialer) Option

func WithHeaders

func WithHeaders(headers http.Header) Option

func WithPolicy

func WithPolicy(policy Policy) Option

func WithResourceLimits

func WithResourceLimits(resourceLimits *limits.Runtime) Option

WithResourceLimits shares one runtime-local connection policy between WebSocket module exports and WebSocket globals.

type Policy

type Policy func(*url.URL) error

Jump to

Keyboard shortcuts

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