Documentation
¶
Index ¶
- Variables
- func Listen(addr string, opts ...Option)
- func Shutdown()
- type Group
- func (c *Group) Add(session *session.Session) error
- func (c *Group) Broadcast(route string, v interface{}) error
- func (c *Group) Close() error
- func (c *Group) Contains(uid int64) bool
- func (c *Group) Count() int
- func (c *Group) FindMember(filter func(ses *session.Session) bool) (*session.Session, error)
- func (c *Group) Leave(s *session.Session) error
- func (c *Group) LeaveAll() error
- func (c *Group) Member(uid int64) (*session.Session, error)
- func (c *Group) Members() []int64
- func (c *Group) Multicast(route string, v interface{}, filter SessionFilter) error
- type Option
- func WithAdvertiseAddr(addr string, retryInterval ...time.Duration) Option
- func WithCheckOriginFunc(fn func(*http.Request) bool) Option
- func WithClientAddr(addr string) Option
- func WithComponents(components *component.Components) Option
- func WithCustomerRemoteServiceRoute(route cluster.CustomerRemoteServiceRoute) Option
- func WithDebugMode() Option
- func WithDictionary(dict map[string]uint16) Option
- func WithGrpcOptions(opts ...grpc.DialOption) Option
- func WithHandshakeValidator(fn func([]byte) error) Option
- func WithHeartbeatInterval(d time.Duration) Option
- func WithIsWebsocket(enableWs bool) Option
- func WithLabel(label string) Option
- func WithLogger(l log.Logger) Option
- func WithMaster() Option
- func WithNodeId(nodeId uint64) Option
- func WithPipeline(pipeline pipeline.Pipeline) Option
- func WithRequestValidator(fn func(route string, uid int64) bool) Option
- func WithSerializer(serializer serialize.Serializer) Option
- func WithTSLConfig(certificate, key string) Option
- func WithTimerPrecision(precision time.Duration) Option
- func WithUnregisterCallback(fn func(member cluster.Member)) Option
- func WithWSPath(path string) Option
- type SessionFilter
Constants ¶
This section is empty.
Variables ¶
var ( ErrCloseClosedGroup = errors.New("close closed group") ErrClosedGroup = errors.New("group closed") ErrMemberNotFound = errors.New("member not found in the group") ErrSessionDuplication = errors.New("session has existed in the current group") )
Errors that could be occurred during message handling.
var VERSION = "0.5.0"
VERSION returns current nano version
Functions ¶
Types ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group represents a session group which used to manage a number of sessions, data send to the group will send to all session in it.
func (*Group) FindMember ¶ added in v1.99.36
FindMember Find a member with customer filter
type Option ¶
func WithAdvertiseAddr ¶ added in v1.99.36
WithAdvertiseAddr sets the advertise address option, it will be the listen address in master node and an advertise address which cluster member to connect
func WithCheckOriginFunc ¶ added in v1.99.36
WithCheckOriginFunc sets the function that check `Origin` in http headers
func WithClientAddr ¶ added in v1.99.36
WithMemberAddr sets the listen address which is used to establish connection between cluster members. Will select an available port automatically if no member address setting and panic if no available port
func WithComponents ¶ added in v1.99.36
func WithComponents(components *component.Components) Option
WithComponents sets the Components
func WithCustomerRemoteServiceRoute ¶ added in v1.99.36
func WithCustomerRemoteServiceRoute(route cluster.CustomerRemoteServiceRoute) Option
WithCustomerRemoteServiceRoute register remote service route
func WithDebugMode ¶ added in v1.99.36
func WithDebugMode() Option
WithDebugMode let 'nano' to run under Debug mode.
func WithDictionary ¶ added in v1.99.36
SetDictionary sets routes map
func WithGrpcOptions ¶ added in v1.99.36
func WithGrpcOptions(opts ...grpc.DialOption) Option
WithGrpcOptions sets the grpc dial options
func WithHandshakeValidator ¶ added in v1.99.36
WithHandshakeValidator sets the function that Verify `handshake` data
func WithHeartbeatInterval ¶ added in v1.99.36
WithHeartbeatInterval sets Heartbeat time interval
func WithIsWebsocket ¶ added in v1.99.36
WithIsWebsocket indicates whether current node WebSocket is enabled
func WithLogger ¶ added in v1.99.36
WithLogger overrides the default logger
func WithMaster ¶ added in v1.99.36
func WithMaster() Option
WithMaster sets the option to indicate whether the current node is master node
func WithNodeId ¶ added in v1.99.36
WithNodeId set nodeId use snowflake nodeId generate sessionId, default: pid
func WithPipeline ¶
func WithRequestValidator ¶ added in v1.99.36
WithRequestValidator 登录检查
func WithSerializer ¶ added in v1.99.36
func WithSerializer(serializer serialize.Serializer) Option
WithSerializer customizes application serializer, which automatically Marshal and UnMarshal handler payload
func WithTSLConfig ¶ added in v1.99.36
WithTSLConfig sets the `key` and `certificate` of TSL
func WithTimerPrecision ¶ added in v1.99.36
SetTimerPrecision sets the ticker precision, and time precision can not less than a Millisecond, and can not change after application running. The default precision is time.Second
func WithUnregisterCallback ¶ added in v1.99.36
WithUnregisterCallback master unregister member event call fn
func WithWSPath ¶ added in v1.99.36
type SessionFilter ¶
SessionFilter represents a filter which was used to filter session when Multicast, the session will receive the message while filter returns true.
Directories
¶
| Path | Synopsis |
|---|---|
|
benchmark
|
|
|
examples
|
|
|
cluster
command
|
|
|
customerroute
command
|
|
|
demo/chat
command
|
|
|
demo/tadpole
command
|
|
|
internal
|
|
|
env
env represents the environment of the current process, includes work path and config path etc.
|
env represents the environment of the current process, includes work path and config path etc. |
