xsocketio

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RequestChecker engineio.CheckerFunc = func(req *http.Request) (http.Header, error) {
	token := common.Setting(`socketio`).String(`token`)
	if len(token) == 0 {
		return nil, nil
	}
	post := req.Header.Get(`Token`)
	if len(post) == 0 {
		post = req.URL.Query().Get(`token`)
	}
	if token != post {
		if log.IsEnabled(log.LevelDebug) {
			log.Debugf(`[socketIO] invalid token: %q`, post)
			log.Debugf(`[socketIO] request headers: %+v`, req.Header)
		}
		return nil, echo.NewError(`invalid token`, code.InvalidToken)
	}
	return nil, nil
}

Functions

func OnConnect

func OnConnect(fns ...func(ctx echo.Context, conn socketio.Conn) error)

func OnDisconnect

func OnDisconnect(fns ...func(ctx echo.Context, conn socketio.Conn, msg string))

func OnError

func OnError(fns ...func(ctx echo.Context, conn socketio.Conn, e error))

func OnEvent

func OnEvent(fns ...func(esi.IWrapper))

func RegisterRoute

func RegisterRoute(e echo.RouteRegister, s ...func(*middleware.CORSConfig))

Types

type Config

type Config struct {
}

func NewConfig

func NewConfig() *Config

func (*Config) FromStore

func (c *Config) FromStore(v echo.H) *Config

Jump to

Keyboard shortcuts

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