websocket

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecodeIngressFunc

type DecodeIngressFunc func(context.Context, []byte) (request interface{}, err error)

Decode request on receiving.

type EncodeEgressFunc

type EncodeEgressFunc func(context.Context, interface{}) (response []byte, err error)

Encode response before sending.

type RequestFunc

type RequestFunc func(context.Context, *http.Request) context.Context

type Server

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

func NewServer

func NewServer(
	e WebSocketEndpoint,
	dec DecodeIngressFunc,
	enc EncodeEgressFunc,
	options ...ServerOption,
) *Server

func (Server) ServeHTTP

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

type ServerOption

type ServerOption func(*Server)

func ServerBefore

func ServerBefore(before ...RequestFunc) ServerOption

func SetSocketConfig

func SetSocketConfig(socketConfig ...SocketConfigFunc) ServerOption

type SocketConfigFunc

type SocketConfigFunc func(context.Context, *websocket.Conn)

type WebSocketEndpoint

type WebSocketEndpoint func(ctx context.Context) (ingress chan interface{}, egress chan interface{}, err error)

Jump to

Keyboard shortcuts

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