Documentation
¶
Index ¶
- Constants
- Variables
- func GetBeforeHandler() func(*Session, string) error
- func GetHandler(handleId int) (func(*Session, []byte) []byte, error)
- func GetHandlerId(name string) (int, error)
- func GetHandlerName(handlerId int) (string, error)
- func GetHandlers() []byte
- func GetRouteHandler(serverType string) func(*Session) string
- func HandleFunc(name string, handler func(*Session, []byte) []byte)
- func NotFound() []byte
- func RegisterBeforeHandler(handler func(*Session, string) error)
- func RegisterHandle(name string)
- func Route(serverType string, handler func(session *Session) string)
- func UniqueId() string
- type Connection
- type Hub
- type Session
- func (session *Session) Bind(name string, handler func())
- func (session *Session) Close()
- func (session *Session) Get(key string) interface{}
- func (session *Session) GetClientConn(serverType string) *grpc.ClientConn
- func (session *Session) HandleData(data []byte)
- func (session *Session) Kick(data []byte)
- func (session *Session) Push(route string, data []byte)
- func (session *Session) Set(key string, value interface{})
- func (session *Session) Trigger(name string)
- func (session *Session) Write(data []byte)
Constants ¶
View Source
const ( STATE_UNAVAIABLE = 1 STATE_AVAIABLE = 2 )
Variables ¶
View Source
var (
ERR_HANDLER_EXIST = errors.New("handler exists")
)
Functions ¶
func GetBeforeHandler ¶
func GetHandlerId ¶
func GetHandlerName ¶
func GetHandlers ¶
func GetHandlers() []byte
func GetRouteHandler ¶
func RegisterBeforeHandler ¶
func RegisterHandle ¶
func RegisterHandle(name string)
Types ¶
type Connection ¶
type Connection interface {
Close() error
}
type Hub ¶
type Hub struct { Sessions map[string]*Session Register chan *Session Unregister chan *Session Closed chan bool // contains filtered or unexported fields }
func (*Hub) GetSessionById ¶
type Session ¶
type Session struct { Id string Conn Connection Send chan []byte // contains filtered or unexported fields }
func (*Session) GetClientConn ¶
func (session *Session) GetClientConn(serverType string) *grpc.ClientConn
func (*Session) HandleData ¶
Click to show internal directories.
Click to hide internal directories.