Documentation
¶
Index ¶
- Constants
- func Accept(opts AcceptOptions) error
- func Broadcast(msg string, values ...Map) error
- func BroadcastIn(space, msg string, values ...Map) error
- func CompressionEnabled() bool
- func CompressionLevel() int
- func Export() Map
- func Groupcast(gid, msg string, values ...Map) error
- func GroupcastIn(space, gid, msg string, values ...Map) error
- func Push(sid, msg string, values ...Map) error
- func PushUser(uid, msg string, values ...Map) error
- func PushUserIn(space, uid, msg string, values ...Map) error
- type AcceptOptions
- type Command
- type Commands
- type Config
- type Conn
- type Context
- func (ctx *Context) Answer(msg string, data Map, results ...Res) error
- func (ctx *Context) AnswerResult(msg string, data Map, results ...Res) Delivery
- func (ctx *Context) BindUser(uid string)
- func (ctx *Context) Broadcast(msg string, values ...Map) error
- func (ctx *Context) BroadcastResult(msg string, values ...Map) Delivery
- func (ctx *Context) Deny(args ...Res)
- func (ctx *Context) Error(args ...Res)
- func (ctx *Context) Fail(args ...Res)
- func (ctx *Context) Groupcast(gid, msg string, values ...Map) error
- func (ctx *Context) GroupcastResult(gid, msg string, values ...Map) Delivery
- func (ctx *Context) Groups() []string
- func (ctx *Context) InGroup(group string) bool
- func (ctx *Context) Invalid(args ...Res)
- func (ctx *Context) Join(groups ...string)
- func (ctx *Context) Leave(groups ...string)
- func (ctx *Context) LeaveAll()
- func (ctx *Context) Next()
- func (ctx *Context) Push(sid, msg string, values ...Map) error
- func (ctx *Context) PushResult(sid, msg string, values ...Map) Delivery
- func (ctx *Context) PushUser(uid, msg string, values ...Map) error
- func (ctx *Context) PushUserResult(uid, msg string, values ...Map) Delivery
- func (ctx *Context) Reply(msg string, values ...Map) error
- func (ctx *Context) ReplyResult(msg string, values ...Map) Delivery
- type Delivery
- func BroadcastResult(msg string, values ...Map) Delivery
- func BroadcastResultIn(space, msg string, values ...Map) Delivery
- func GroupcastResult(gid, msg string, values ...Map) Delivery
- func GroupcastResultIn(space, gid, msg string, values ...Map) Delivery
- func PushResult(sid, msg string, values ...Map) Delivery
- func PushUserResult(uid, msg string, values ...Map) Delivery
- func PushUserResultIn(space, uid, msg string, values ...Map) Delivery
- type Filter
- type Filters
- type Handler
- type Handlers
- type Hook
- type Hooks
- type Message
- type Messages
- type Module
- func (m *Module) Close()
- func (m *Module) Config(global Map)
- func (m *Module) Open()
- func (m *Module) Register(name string, value Any)
- func (m *Module) RegisterCommand(name string, command Command)
- func (m *Module) RegisterCommands(prefix string, items Commands)
- func (m *Module) RegisterFilter(name string, filter Filter)
- func (m *Module) RegisterFilters(items Filters)
- func (m *Module) RegisterHandler(name string, handler Handler)
- func (m *Module) RegisterHandlers(items Handlers)
- func (m *Module) RegisterHook(name string, hook Hook)
- func (m *Module) RegisterHooks(items Hooks)
- func (m *Module) RegisterMessage(name string, message Message)
- func (m *Module) RegisterMessages(prefix string, items Messages)
- func (m *Module) Setup()
- func (m *Module) Start()
- func (m *Module) Stop()
- type Session
- type Stats
Constants ¶
View Source
const ( TextMessage = 1 BinaryMessage = 2 CloseMessage = 8 PingMessage = 9 PongMessage = 10 )
Variables ¶
This section is empty.
Functions ¶
func Accept ¶
func Accept(opts AcceptOptions) error
func BroadcastIn ¶ added in v0.20.0
func CompressionEnabled ¶
func CompressionEnabled() bool
func CompressionLevel ¶
func CompressionLevel() int
func GroupcastIn ¶ added in v0.20.0
func PushUserIn ¶ added in v0.20.0
Types ¶
type AcceptOptions ¶
type Command ¶
type Command struct {
Space string `json:"space,omitempty"`
Name string `json:"name"`
Desc string `json:"desc"`
Nullable bool `json:"nullable"`
Args Vars `json:"args"`
Setting Map `json:"-"`
}
func (Command) RegistryComponent ¶
type Commands ¶
func (Commands) RegistryComponent ¶
type Config ¶
type Config struct {
Format string `json:"format"`
Codec string `json:"codec"`
PingInterval time.Duration `json:"ping_interval"`
ReadTimeout time.Duration `json:"read_timeout"`
WriteTimeout time.Duration `json:"write_timeout"`
MaxMessageSize int64 `json:"max_message_size"`
QueueSize int `json:"queue_size"`
QueuePolicy string `json:"queue_policy"`
Compression bool `json:"compression"`
CompressLevel int `json:"compress_level"`
ObserveInterval time.Duration `json:"observe_interval"`
ObserveLog bool `json:"observe_log"`
ObserveTrace bool `json:"observe_trace"`
Setting Map `json:"-"`
}
type Context ¶
type Context struct {
*infra.Meta
Session *Session
Conn Conn
Op string
Space string
Type int
Name string
Message Message
Command Command
Setting Map
Value Map
Args Map
Locals Map
Input []byte
Output []byte
// contains filtered or unexported fields
}
func (*Context) AnswerResult ¶
func (*Context) BroadcastResult ¶
func (*Context) GroupcastResult ¶
func (*Context) PushResult ¶
func (*Context) PushUserResult ¶
func (*Context) ReplyResult ¶
type Delivery ¶
type Delivery struct {
Hit int `json:"hit"`
Success int `json:"success"`
Failed int `json:"failed"`
FirstError string `json:"first_error,omitempty"`
}
func BroadcastResult ¶
func BroadcastResultIn ¶ added in v0.20.0
func GroupcastResult ¶
func GroupcastResultIn ¶ added in v0.20.0
func PushResult ¶
func PushUserResult ¶
func PushUserResultIn ¶ added in v0.20.0
type Filter ¶
type Filter struct {
Space string `json:"space,omitempty"`
Name string `json:"name"`
Desc string `json:"desc"`
Message ctxFunc `json:"-"`
}
func (Filter) RegistryComponent ¶
type Filters ¶
func (Filters) RegistryComponent ¶
type Handler ¶
type Handler struct {
Space string `json:"space,omitempty"`
Name string `json:"name"`
Desc string `json:"desc"`
Error ctxFunc `json:"-"`
Invalid ctxFunc `json:"-"`
Denied ctxFunc `json:"-"`
}
func (Handler) RegistryComponent ¶
type Handlers ¶
func (Handlers) RegistryComponent ¶
type Hook ¶
type Hook struct {
Space string `json:"space,omitempty"`
Name string `json:"name"`
Desc string `json:"desc"`
Open ctxFunc `json:"-"`
Close ctxFunc `json:"-"`
Receive ctxFunc `json:"-"`
Send ctxFunc `json:"-"`
}
func (Hook) RegistryComponent ¶
type Hooks ¶
func (Hooks) RegistryComponent ¶
type Message ¶
type Message struct {
Space string `json:"space,omitempty"`
Name string `json:"name"`
Desc string `json:"desc"`
Nullable bool `json:"nullable"`
Args Vars `json:"args"`
Setting Map `json:"-"`
Action ctxFunc `json:"-"`
}
func (Message) RegistryComponent ¶
type Messages ¶
func (Messages) RegistryComponent ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func (*Module) RegisterCommand ¶
func (*Module) RegisterCommands ¶
func (*Module) RegisterFilter ¶
func (*Module) RegisterFilters ¶
func (*Module) RegisterHandler ¶
func (*Module) RegisterHandlers ¶
func (*Module) RegisterHook ¶
func (*Module) RegisterHooks ¶
func (*Module) RegisterMessage ¶
func (*Module) RegisterMessages ¶
type Session ¶
type Session struct {
ID string `json:"id"`
Space string `json:"space"`
User string `json:"user,omitempty"`
Name string `json:"name"`
Site string `json:"site,omitempty"`
Host string `json:"host,omitempty"`
Domain string `json:"domain,omitempty"`
RootDomain string `json:"root_domain,omitempty"`
Path string `json:"path,omitempty"`
Uri string `json:"uri,omitempty"`
Setting Map `json:"setting,omitempty"`
Params Map `json:"params,omitempty"`
Query Map `json:"query,omitempty"`
Form Map `json:"form,omitempty"`
Value Map `json:"value,omitempty"`
Args Map `json:"args,omitempty"`
Locals Map `json:"locals,omitempty"`
Groups map[string]Any `json:"groups,omitempty"`
Meta *infra.Meta `json:"-"`
Conn Conn `json:"-"`
// contains filtered or unexported fields
}
func SessionByID ¶
func SessionsByUser ¶
func SessionsByUserIn ¶ added in v0.20.0
type Stats ¶
type Stats struct {
Connections int64 `json:"connections"`
Users int64 `json:"users"`
MessagesReceived int64 `json:"messages_received"`
MessagesSent int64 `json:"messages_sent"`
ReceiveFailed int64 `json:"receive_failed"`
SendFailed int64 `json:"send_failed"`
BytesReceived int64 `json:"bytes_received"`
BytesSent int64 `json:"bytes_sent"`
AvgReceiveBytes int64 `json:"avg_receive_bytes"`
AvgSendBytes int64 `json:"avg_send_bytes"`
Queued int64 `json:"queued"`
Dropped int64 `json:"dropped"`
}
Click to show internal directories.
Click to hide internal directories.