websocket

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: MIT Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Dial added in v0.14.0

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

func ReadWebsocket added in v0.14.4

func ReadWebsocket[T any](conn io.Reader, writer chan<- []byte) (out T, err error)

func Serve added in v0.14.0

func Serve[T any](r *gin.RouterGroup, path string, acceptFunc func(c *gin.Context) bool, wsfunc WSHandler[T])

func WriteWebsocket added in v0.14.4

func WriteWebsocket[T any](writer chan<- []byte, write Write[T]) error

Types

type WSHandler added in v0.14.0

type WSHandler[T any] func(<-chan T, chan<- Write[T], gin.Params, context.Context)

type Write added in v0.14.0

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

Jump to

Keyboard shortcuts

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