Documentation
¶
Index ¶
- Variables
- func SendDefault(session Session, data any) error
- func SendStream(session Session, text string, done bool) error
- type Acceptor
- type App
- func (my *App) AddInterceptor(interceptor InterceptorFunc)
- func (my *App) Documentation(getPtrNames bool) (map[string]any, error)
- func (my *App) Listen()
- func (my *App) OnHandShaken(handler func(session Session))
- func (my *App) RangeSessions(handler func(session Session))
- func (my *App) Register(comp component.Component, opts ...component.Option) error
- type AppOption
- type Attachment
- type AttachmentImpl
- func (my *AttachmentImpl) Bool(key any) bool
- func (my *AttachmentImpl) Float32(key any) float32
- func (my *AttachmentImpl) Float64(key any) float64
- func (my *AttachmentImpl) Get1(key any) any
- func (my *AttachmentImpl) Get2(key any) (any, bool)
- func (my *AttachmentImpl) Int(key any) int
- func (my *AttachmentImpl) Int32(key any) int32
- func (my *AttachmentImpl) Int64(key any) int64
- func (my *AttachmentImpl) Range(f func(key, value any) bool)
- func (my *AttachmentImpl) Set(key any, value any)
- func (my *AttachmentImpl) String(key any) string
- func (my *AttachmentImpl) UInt32(key any) uint32
- func (my *AttachmentImpl) UInt64(key any) uint64
- type Error
- type InterceptorFunc
- type Manager
- func (my *Manager) AddHandler(route string, handler *component.Handler)
- func (my *Manager) AddInterceptor(interceptor InterceptorFunc)
- func (my *Manager) AddSerdeBuilder(name string, builder serdeBuilder)
- func (my *Manager) CloneRouteKinds() map[string]int32
- func (my *Manager) CreateSerde(name string, session Session) serde.Serde
- func (my *Manager) GetHandlerByKind(kind int32) *component.Handler
- func (my *Manager) NewSession(link intern.Link) Session
- func (my *Manager) RebuildHandlerKinds()
- type Session
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmptyHandler = NewError("EmptyHandler", "handler is empty")
View Source
var ErrInvalidArgument = NewError("InvalidArgument", "argument is not valid")
View Source
var ErrInvalidRoute = NewError("InvalidRoute", "route is not valid")
View Source
var ErrNilSerde = NewError("NilSerde", "serde is nil")
Functions ¶
func SendDefault ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) AddInterceptor ¶
func (my *App) AddInterceptor(interceptor InterceptorFunc)
func (*App) Documentation ¶
Documentation returns handler and remotes documentation
func (*App) OnHandShaken ¶
OnHandShaken 暴露一个OnConnected()事件暂时没有看到很大的意义,因为handshake必须是第一个消息 如果需要接入握手事件的话, 可以自己注册OnHandShaken事件
func (*App) RangeSessions ¶
RangeSessions 设计这个方法的目的是为了排查如下bug: 2个相同的uid登录了server, playerManager中好像有player丢失了
type AppOption ¶
type AppOption func(*appOptions)
func WithHeartbeatInterval ¶
func WithKickInterval ¶
func WithSerdeBuilder ¶
type Attachment ¶
type AttachmentImpl ¶
type AttachmentImpl struct {
// contains filtered or unexported fields
}
func (*AttachmentImpl) Bool ¶
func (my *AttachmentImpl) Bool(key any) bool
func (*AttachmentImpl) Float32 ¶
func (my *AttachmentImpl) Float32(key any) float32
func (*AttachmentImpl) Float64 ¶
func (my *AttachmentImpl) Float64(key any) float64
func (*AttachmentImpl) Get1 ¶
func (my *AttachmentImpl) Get1(key any) any
func (*AttachmentImpl) Int ¶
func (my *AttachmentImpl) Int(key any) int
func (*AttachmentImpl) Int32 ¶
func (my *AttachmentImpl) Int32(key any) int32
func (*AttachmentImpl) Int64 ¶
func (my *AttachmentImpl) Int64(key any) int64
func (*AttachmentImpl) Range ¶
func (my *AttachmentImpl) Range(f func(key, value any) bool)
func (*AttachmentImpl) Set ¶
func (my *AttachmentImpl) Set(key any, value any)
func (*AttachmentImpl) String ¶
func (my *AttachmentImpl) String(key any) string
func (*AttachmentImpl) UInt32 ¶
func (my *AttachmentImpl) UInt32(key any) uint32
func (*AttachmentImpl) UInt64 ¶
func (my *AttachmentImpl) UInt64(key any) uint64
type InterceptorFunc ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) AddHandler ¶
func (*Manager) AddInterceptor ¶
func (my *Manager) AddInterceptor(interceptor InterceptorFunc)
func (*Manager) AddSerdeBuilder ¶
func (*Manager) CloneRouteKinds ¶
func (*Manager) CreateSerde ¶
func (*Manager) GetHandlerByKind ¶
func (*Manager) RebuildHandlerKinds ¶
func (my *Manager) RebuildHandlerKinds()
type Session ¶
type Session interface {
Handshake() error // server主动向client发送服务器的配置信息
Kick(reason string) error // server主动踢client
Send(route string, v any) error
Echo(handler func()) error
OnHandShaken(handler func()) // 握手完成后
OnClosed(handler func()) // 连接关闭后
Id() int64
RemoteAddr() net.Addr
Attachment() Attachment
Nonce() int32
}
func GetSessionFromCtx ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.