uws

package
v0.7.28 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MessageTypeString added in v0.2.37

func MessageTypeString(i int) string

Types

type Client

type Client struct {
	Options Options
	Events  Events
	// contains filtered or unexported fields
}

func NewClient added in v0.2.37

func NewClient(url string) *Client

func (*Client) Cancel added in v0.7.27

func (o *Client) Cancel()

func (*Client) Close added in v0.2.37

func (o *Client) Close()

func (*Client) Connected added in v0.2.40

func (o *Client) Connected() bool

func (*Client) Log added in v0.2.42

func (o *Client) Log() *ulog.Log

func (*Client) Run added in v0.2.37

func (o *Client) Run()

func (*Client) Send added in v0.2.37

func (o *Client) Send(messageType int, data []byte) error

func (*Client) SendBinary added in v0.2.37

func (o *Client) SendBinary(data []byte) error

func (*Client) SendJson added in v0.2.37

func (o *Client) SendJson(v any) (err error)

func (*Client) SendText added in v0.2.37

func (o *Client) SendText(data string) error

func (*Client) WithAppendPath added in v0.2.37

func (o *Client) WithAppendPath(path string) *Client

func (*Client) WithBase added in v0.2.37

func (o *Client) WithBase(base string) *Client

func (*Client) WithLog added in v0.2.37

func (o *Client) WithLog(log *ulog.Log) *Client

func (*Client) WithOnBinaryMessage added in v0.2.37

func (o *Client) WithOnBinaryMessage(f func([]byte))

func (*Client) WithOnCloseError added in v0.2.37

func (o *Client) WithOnCloseError(f func(error))

func (*Client) WithOnConnected added in v0.2.37

func (o *Client) WithOnConnected(f func())

func (*Client) WithOnDial added in v0.2.37

func (o *Client) WithOnDial(f func(string))

func (*Client) WithOnDialError added in v0.2.37

func (o *Client) WithOnDialError(f func(error) bool)

func (*Client) WithOnDisconnected added in v0.2.37

func (o *Client) WithOnDisconnected(f func())

func (*Client) WithOnMessage added in v0.2.37

func (o *Client) WithOnMessage(f func(int, []byte))

func (*Client) WithOnPing added in v0.2.38

func (o *Client) WithOnPing(f func())

func (*Client) WithOnPreDial added in v0.2.58

func (o *Client) WithOnPreDial(f func(string) string)

func (*Client) WithOnTextMessage added in v0.2.37

func (o *Client) WithOnTextMessage(f func(string))

func (*Client) WithPath added in v0.2.37

func (o *Client) WithPath(path string) *Client

func (*Client) WithProxy added in v0.2.37

func (o *Client) WithProxy(proxy string) *Client

func (*Client) WithProxyUrl added in v0.2.37

func (o *Client) WithProxyUrl(url *url.URL) *Client

type Events added in v0.2.38

type Events struct {
	OnPing         func()
	OnMessage      func(int, []byte)
	OnPreDial      func(string) string
	OnDial         func(string)
	OnDialError    func(error) bool
	OnConnected    func()
	OnDisconnected func()
	OnCloseError   func(error)
}

func (*Events) SetOnBinaryMessage added in v0.2.38

func (o *Events) SetOnBinaryMessage(f func([]byte))

func (*Events) SetOnTextMessage added in v0.2.38

func (o *Events) SetOnTextMessage(f func(string))

type LogMessage added in v0.2.38

type LogMessage struct {
	Type bool
	Size bool
	Data bool
}

type Options added in v0.2.37

type Options struct {
	Base               string
	Path               string
	Proxy              *url.URL
	InsecureSkipVerify bool
	PingInterval       time.Duration
	ReDialInterval     time.Duration
	ReDialDelay        time.Duration
	HandshakeTimeout   time.Duration
	ReadTimeout        time.Duration
	SendTimeout        time.Duration
	LogSent            LogMessage
	LogRecv            LogMessage
}

func (*Options) AppendPath added in v0.2.37

func (o *Options) AppendPath(path string)

func (*Options) EmptyUrl added in v0.2.37

func (o *Options) EmptyUrl() bool

func (*Options) SetDefaultTimeouts added in v0.2.38

func (o *Options) SetDefaultTimeouts()

func (*Options) SetProxy added in v0.2.37

func (o *Options) SetProxy(proxy string)

func (*Options) Url added in v0.2.37

func (o *Options) Url() string

Jump to

Keyboard shortcuts

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