camSocket

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

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

init config

func (*SocketComponent) Start

func (comp *SocketComponent) Start()

start

func (*SocketComponent) Stop

func (comp *SocketComponent) Stop()

stop

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 camStatics.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 {
	camStatics.ContextInterface
	camContext.MessageContextInterface
	SetConn(conn net.Conn)
	GetConn() net.Conn
	SetRecv(recv []byte)
	GetRecv() []byte
}

type SocketSession

type SocketSession struct {
	camStatics.SessionInterface
	// contains filtered or unexported fields
}

func NewSocketSession

func NewSocketSession() *SocketSession

func (*SocketSession) Del

func (sess *SocketSession) Del(key string)

delete key

func (*SocketSession) Destroy

func (sess *SocketSession) Destroy()

destroy session

func (*SocketSession) Get

func (sess *SocketSession) Get(key string) interface{}

get session value

func (*SocketSession) GetSessionId

func (sess *SocketSession) GetSessionId() string

func (*SocketSession) Set

func (sess *SocketSession) Set(key string, value interface{})

set session value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL