xsocketio

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: AGPL-3.0 Imports: 11 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 Close added in v0.4.8

func Close(namespace string) bool

func CloseAll added in v0.4.8

func CloseAll()

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))

func SocketIO added in v0.4.8

func SocketIO(namespace string) *esi.Wrapper

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