client

package
v3.30.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusNormal = uint32(1)
	StatusStop   = uint32(2)
)

Variables

View Source
var ClosedError = errors.New("websocket closed")

Functions

This section is empty.

Types

type Client

type Client struct {
	BufferSize           int
	WriteWait            time.Duration
	PingPeriod           time.Duration
	PongWait             time.Duration
	TextMessageHandler   func(message []byte)
	BinaryMessageHandler func(message []byte)
	ErrorHandler         func(err error)
	// contains filtered or unexported fields
}

func NewClient

func NewClient(conn *websocket.Conn, sendChanLength uint) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) GetEnvelope

func (c *Client) GetEnvelope() *Envelope

func (*Client) IsRunning

func (c *Client) IsRunning() bool

func (*Client) PutEnvelope

func (c *Client) PutEnvelope(envelope *Envelope)

func (*Client) ReadPump

func (c *Client) ReadPump()

func (*Client) Send

func (c *Client) Send(envelope *Envelope) error

func (*Client) WritePump

func (c *Client) WritePump()

type Envelope

type Envelope struct {
	Type      int
	Msg       *bytes.Buffer
	ErrorChan chan error
}

func (*Envelope) Reset

func (e *Envelope) Reset()

type EnvelopePool

type EnvelopePool struct {
	// contains filtered or unexported fields
}
var GlobalEnvelopePool EnvelopePool

func (*EnvelopePool) Get

func (ep *EnvelopePool) Get() *Envelope

func (*EnvelopePool) Put

func (ep *EnvelopePool) Put(epv *Envelope)

type WSAction

type WSAction struct {
	Action string          `json:"action"`
	Args   json.RawMessage `json:"args"`
}

Jump to

Keyboard shortcuts

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