websocket

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImplemented = errors.New("operation not implemented")
	ErrNoErrorHandled = errors.New("handled")
)
View Source
var BufferSize = 100

Functions

func Dial

func Dial[T any](
	url *url.URL,
	ctx context.Context,
) (readerOut <-chan T, writerOut chan<- Write[T], err error)

func Serve

func Serve[T any](acceptFunc func(r *http.Request) bool, wsfunc WSHandler[T]) http.HandlerFunc

func ServeFiber added in v0.7.8

func ServeFiber[T any](
	r fiber.Router,
	path string,
	acceptFunc func(c *fiber.Ctx) error,
	wsfunc WSHandler[T],
)

Types

type WSHandler

type WSHandler[T any] func(<-chan T, chan<- Write[T], *http.Request, context.Context)

type Write

type Write[T any] struct {
	Data T            `json:"data"`
	Err  chan<- error `json:"err"`
}

Directories

Path Synopsis
client command
server command

Jump to

Keyboard shortcuts

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