Documentation ¶
Index ¶
- type SocketComponent
- type SocketComponentConfig
- type SocketContext
- type SocketContextInterface
- type SocketSession
- func (sess *SocketSession) Del(key string)
- func (sess *SocketSession) Destroy()
- func (sess *SocketSession) Get(key string) interface{}
- func (sess *SocketSession) GetConn() net.Conndeprecated
- func (sess *SocketSession) GetSessionId() string
- func (sess *SocketSession) Set(key string, value interface{})
- func (sess *SocketSession) SetConn(conn net.Conn)deprecated
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SocketComponent ¶
type SocketComponent struct { component.Component camRouter.RouterPlugin camContext.ContextPlugin camMiddleware.MiddlewarePlugin // contains filtered or unexported fields }
func (*SocketComponent) GetConfig ¶
func (comp *SocketComponent) GetConfig() *SocketComponentConfig
get config
func (*SocketComponent) Init ¶
func (comp *SocketComponent) Init(configI camBase.ComponentConfigInterface)
init config
type SocketComponentConfig ¶
type SocketComponentConfig struct { component.ComponentConfig camRouter.RouterPluginConfig camContext.ContextPluginConfig camMiddleware.MiddlewarePluginConfig // tcp listen port Port uint16 // Block transfer end. // Default: '\x17' // // Example: // recvMessage := "17\x17receive a message" // recvMessage can be divided into three parts: [len], [etb flat], [content] := "17", "\x17", "receive a message" // [len]: the content length // [etb flat]: block transfer end // [content]: actual received data Etb byte // Max number of bytes in a single receive message // Default: 1MB RecvMaxLen uint64 // Max number of bytes in a single send message // Default: 128MB SendMaxLen uint64 // Read recv message timeout RecvTimeout time.Duration // Write send message timeout SendTimeout time.Duration // socket conn handler ConnHandler camBase.SocketConnHandler // trace recv and send message Trace bool }
func NewSocketComponentConfig ¶
func NewSocketComponentConfig(port uint16) *SocketComponentConfig
type SocketContext ¶ added in v0.4.1
type SocketContext struct { camContext.Context camContext.MessageContext // contains filtered or unexported fields }
func (*SocketContext) GetConn ¶ added in v0.4.1
func (ctx *SocketContext) GetConn() net.Conn
func (*SocketContext) GetRecv ¶ added in v0.4.1
func (ctx *SocketContext) GetRecv() []byte
func (*SocketContext) SetConn ¶ added in v0.4.1
func (ctx *SocketContext) SetConn(conn net.Conn)
func (*SocketContext) SetRecv ¶ added in v0.4.1
func (ctx *SocketContext) SetRecv(recv []byte)
type SocketContextInterface ¶ added in v0.4.1
type SocketContextInterface interface { camBase.ContextInterface camContext.MessageContextInterface SetConn(conn net.Conn) GetConn() net.Conn SetRecv(recv []byte) GetRecv() []byte }
type SocketSession ¶
type SocketSession struct { camBase.SessionInterface // contains filtered or unexported fields }
func NewSocketSession ¶
func NewSocketSession() *SocketSession
func (*SocketSession) Get ¶
func (sess *SocketSession) Get(key string) interface{}
get session value
func (*SocketSession) GetConn
deprecated
added in
v0.4.1
func (sess *SocketSession) GetConn() net.Conn
Deprecated: remove on v0.5.0
func (*SocketSession) GetSessionId ¶
func (sess *SocketSession) GetSessionId() string
func (*SocketSession) Set ¶
func (sess *SocketSession) Set(key string, value interface{})
set session value
func (*SocketSession) SetConn
deprecated
added in
v0.4.1
func (sess *SocketSession) SetConn(conn net.Conn)
Deprecated: remove on v0.5.0
Click to show internal directories.
Click to hide internal directories.