Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandshakeClientData ¶
type HandshakeClientData struct { Platform string `json:"platform"` LibVersion string `json:"libVersion"` BuildNumber string `json:"clientBuildNumber"` Version string `json:"clientVersion"` }
HandshakeClientData represents information about the client sent on the handshake.
type HandshakeData ¶
type HandshakeData struct { Sys HandshakeClientData `json:"sys"` User map[string]interface{} `json:"user,omitempty"` }
HandshakeData represents information about the handshake sent by the client. `sys` corresponds to information independent from the app and `user` information that depends on the app and is customized by the user.
type Session ¶
type Session interface { GetOnCloseCallbacks() []func() GetIsFrontend() bool GetSubscriptions() []*nats.Subscription SetOnCloseCallbacks(callbacks []func()) SetIsFrontend(isFrontend bool) SetSubscriptions(subscriptions []*nats.Subscription) Push(route string, v interface{}) error ResponseMID(ctx context.Context, mid uint, v interface{}, err ...bool) error ID() int64 UID() string GetData() map[string]interface{} SetData(data map[string]interface{}) error GetDataEncoded() []byte SetDataEncoded(encodedData []byte) error SetFrontendData(frontendID string, frontendSessionID int64) Bind(ctx context.Context, uid string) error Kick(ctx context.Context) error OnClose(c func()) error Close() RemoteAddr() net.Addr Remove(key string) error Set(key string, value interface{}) error HasKey(key string) bool Get(key string) interface{} Int(key string) int Int8(key string) int8 Int16(key string) int16 Int32(key string) int32 Int64(key string) int64 Uint(key string) uint Uint8(key string) uint8 Uint16(key string) uint16 Uint32(key string) uint32 Uint64(key string) uint64 Float32(key string) float32 Float64(key string) float64 String(key string) string Value(key string) interface{} PushToFront(ctx context.Context) error Clear() SetHandshakeData(data *HandshakeData) GetHandshakeData() *HandshakeData }
Session represents a client session, which can store data during the connection. All data is released when the low-level connection is broken. Session instance related to the client will be passed to Handler method in the context parameter.
type SessionPool ¶
type SessionPool interface { NewSession(entity networkentity.NetworkEntity, frontend bool, UID ...string) Session GetSessionCount() int64 GetSessionCloseCallbacks() []func(s Session) GetSessionByUID(uid string) Session GetSessionByID(id int64) Session OnSessionBind(f func(ctx context.Context, s Session) error) OnAfterSessionBind(f func(ctx context.Context, s Session) error) OnSessionClose(f func(s Session)) CloseAll() }
SessionPool centralizes all sessions within a Pitaya app
func NewSessionPool ¶
func NewSessionPool() SessionPool
NewSessionPool returns a new session pool instance