session

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2018 License: LGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package session privides websocket server manager sessionlist

Index

Constants

View Source
const MAX_SESSION_COUNT = 3000
View Source
const SESSION_TIMEOUT int64 = 300

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	sync.Mutex

	TxHashArr []TxHashInfo //transaction hashes in this session
	// contains filtered or unexported fields
}

websocket session

func (*Session) AppendTxHash

func (self *Session) AppendTxHash(txhash string)

append transaction hash

func (*Session) Close

func (self *Session) Close()

close session

func (*Session) GetSessionId

func (self *Session) GetSessionId() string

func (*Session) RemoveTimeoverTxHashes

func (self *Session) RemoveTimeoverTxHashes() (remove []TxHashInfo)

remove timew over transaction hashes

func (*Session) Send

func (self *Session) Send(data []byte) error

send to client

func (*Session) SessionTimeoverCheck

func (self *Session) SessionTimeoverCheck() bool

sesseion time over check

func (*Session) UpdateActiveTime

func (self *Session) UpdateActiveTime()

update active time

type SessionList

type SessionList struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSessionList

func NewSessionList() *SessionList

new websocket session list

func (*SessionList) CloseSession

func (self *SessionList) CloseSession(session *Session)

func (*SessionList) ForEachSession

func (self *SessionList) ForEachSession(visit func(*Session))

func (*SessionList) GetSessionById

func (self *SessionList) GetSessionById(sessionId string) *Session

func (*SessionList) GetSessionCount

func (self *SessionList) GetSessionCount() int

func (*SessionList) NewSession

func (self *SessionList) NewSession(wsConn *websocket.Conn) (session *Session, err error)

type TxHashInfo

type TxHashInfo struct {
	TxHash    string //transaction hash
	StartTime int64  //recv tranasction time
}

Jump to

Keyboard shortcuts

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