connection

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	Identifier identification.Identifier
	// contains filtered or unexported fields
}

func (*Conn) Close

func (c *Conn) Close()

func (*Conn) Ping

func (c *Conn) Ping(writeWaitInterval time.Duration) error

func (*Conn) ReadMessage

func (c *Conn) ReadMessage() (messageType int, p []byte, err error)

func (*Conn) WriteMessage

func (c *Conn) WriteMessage(messageType int, data []byte) error

type Table

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

func NewTable

func NewTable(maxUser int) *Table

func (*Table) Exists

func (t *Table) Exists(c identification.Identifier) bool

func (*Table) HasBatch

func (t *Table) HasBatch(c identification.Identifier, id string) bool

func (*Table) Remove

func (t *Table) Remove(c identification.Identifier)

func (*Table) RemoveBatch

func (t *Table) RemoveBatch(c identification.Identifier, id string)

func (*Table) Store

func (t *Table) Store(c identification.Identifier) error

func (*Table) StoreBatch

func (t *Table) StoreBatch(c identification.Identifier, id string)

func (*Table) TotalConnection

func (t *Table) TotalConnection() int

func (*Table) TotalConnectionPerGroup

func (t *Table) TotalConnectionPerGroup() map[string]int

type Upgrader

type Upgrader struct {
	Table *Table
	// contains filtered or unexported fields
}

func NewUpgrader

func NewUpgrader(conf UpgraderConfig) *Upgrader

func (*Upgrader) Upgrade

func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request) (Conn, error)

type UpgraderConfig

type UpgraderConfig struct {
	ReadBufferSize    int
	WriteBufferSize   int
	CheckOrigin       bool
	MaxUser           int
	PongWaitInterval  time.Duration
	WriteWaitInterval time.Duration
	ConnIDHeader      string
	ConnGroupHeader   string
	ConnGroupDefault  string
}

Jump to

Keyboard shortcuts

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