ws

package
v0.0.0-...-33ac8c3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventAuth = "auth"
	EventPing = "ping"
	EventPong = "pong"
)
View Source
const (
	ServerSystem = "system"
)

Variables

This section is empty.

Functions

func NewWsCodec

func NewWsCodec() *wsCodec

func NewWsServer

func NewWsServer(cfg *dto.GatewayConfig, ce cache.Provider, tcpAddr string) gnet.EventHandler

Types

type Server

type Server struct {
	gnet.BuiltinEventEngine
	// contains filtered or unexported fields
}

func (*Server) OnBoot

func (w *Server) OnBoot(eng gnet.Engine) gnet.Action

func (*Server) OnClose

func (w *Server) OnClose(c gnet.Conn, err error) gnet.Action

func (*Server) OnOpen

func (w *Server) OnOpen(c gnet.Conn) (out []byte, action gnet.Action)

func (*Server) OnShutdown

func (w *Server) OnShutdown(eng gnet.Engine)

func (*Server) OnTick

func (w *Server) OnTick() (delay time.Duration, action gnet.Action)

func (*Server) OnTraffic

func (w *Server) OnTraffic(c gnet.Conn) gnet.Action

type User

type User struct {
	Id int64 `json:"id"`
}

type UserClaims

type UserClaims struct {
	User User
	jwt.RegisteredClaims
}

func Intercept

func Intercept(ce cache.Provider, authHeader string) *UserClaims

Jump to

Keyboard shortcuts

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