session

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: BSD-3-Clause Imports: 12 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// TEXT is text type message.
	TEXT = FrameType(frame.String)
	// BINARY is binary type message.
	BINARY = FrameType(frame.Binary)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultIDGenerator

type DefaultIDGenerator struct {
	ID uint64
}

func (*DefaultIDGenerator) NewID

func (g *DefaultIDGenerator) NewID() string

type FrameType

type FrameType frame.Type

FrameType is type of a message frame.

type IDGenerator

type IDGenerator interface {
	NewID() string
}

IDGenerator generates new session id. Default behavior is simple increasing number. If you need custom session id, for example using local ip as perfix, you can implement SessionIDGenerator and save in Configure. Engine.io will use custom one to generate new session id.

type Manager

type Manager struct {
	IDGenerator
	// contains filtered or unexported fields
}

func NewManager

func NewManager(gen IDGenerator) *Manager

func (*Manager) Add

func (m *Manager) Add(s *Session)

func (*Manager) Count

func (m *Manager) Count() int

func (*Manager) Get

func (m *Manager) Get(sid string) *Session

func (*Manager) Remove

func (m *Manager) Remove(sid string)

type Pauser

type Pauser interface {
	Pause()
	Resume()
}

Pauser is connection which can be paused and resumes.

type Session

type Session struct {
	// contains filtered or unexported fields
}

func New

func New(conn transport.Conn, sid, transport string, params transport.ConnParameters) (*Session, error)

func (*Session) Close

func (s *Session) Close() error

func (*Session) Context

func (s *Session) Context() interface{}

func (*Session) ID

func (s *Session) ID() string

func (*Session) InitSession

func (s *Session) InitSession() error

func (*Session) LocalAddr

func (s *Session) LocalAddr() net.Addr

func (*Session) NextReader

func (s *Session) NextReader() (FrameType, io.ReadCloser, error)

NextReader attempts to obtain a ReadCloser from the session's connection. When finished writing, the caller MUST Close the ReadCloser to unlock the connection's FramerReader.

func (*Session) NextWriter

func (s *Session) NextWriter(typ FrameType) (io.WriteCloser, error)

NextWriter attempts to obtain a WriteCloser from the session's connection. When finished writing, the caller MUST Close the WriteCloser to unlock the connection's FrameWriter.

func (*Session) RemoteAddr

func (s *Session) RemoteAddr() net.Addr

func (*Session) RemoteHeader

func (s *Session) RemoteHeader() http.Header

func (*Session) ServeHTTP

func (s *Session) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Session) SetContext

func (s *Session) SetContext(v interface{})

func (*Session) Transport

func (s *Session) Transport() string

func (*Session) URL

func (s *Session) URL() url.URL

func (*Session) Upgrade

func (s *Session) Upgrade(transport string, conn transport.Conn)

Jump to

Keyboard shortcuts

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