camSocket

package
v0.4.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: Apache-2.0 Imports: 12 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
	camPluginRouter.RouterPlugin
	camPluginContext.ContextPlugin
	// 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

func (*SocketComponent) Start

func (comp *SocketComponent) Start()

start

func (*SocketComponent) Stop

func (comp *SocketComponent) Stop()

stop

type SocketComponentConfig

type SocketComponentConfig struct {
	component.ComponentConfig
	camPluginRouter.RouterPluginConfig
	camPluginContext.ContextPluginConfig

	// 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
	// message parse handler.
	// it can read route and values info form the message
	MessageParseHandler camBase.MessageParseHandler

	// trace recv and send message
	Trace bool
}

func NewSocketComponentConfig

func NewSocketComponentConfig(port uint16) *SocketComponentConfig

type SocketSession

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

func NewSocketSession

func NewSocketSession(conn net.Conn) *SocketSession

func (*SocketSession) Del

func (sess *SocketSession) Del(key interface{})

delete key

func (*SocketSession) Destroy

func (sess *SocketSession) Destroy()

destroy session

func (*SocketSession) Get

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

get session value

func (*SocketSession) GetSessionId

func (sess *SocketSession) GetSessionId() string

func (*SocketSession) Set

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

set session value

Jump to

Keyboard shortcuts

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