wsconnector

package
v0.0.0-...-a2a535d Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CloseErr  = errors.New("Connection closed")
	BufferErr = errors.New("Message buffer is full")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	WriteWait time.Duration

	MaxMessageSize int64

	MinRecTime time.Duration

	MaxRecTime time.Duration

	RecFactor float64

	MessageBufferSize int
}

type WSConnector

type WSConnector struct {
	Config *Config

	WebSocket *WebSocket
	// contains filtered or unexported fields
}

The basis is this connector "github.com/togettoyou/wsc" with various extensions

func NewWSConnector

func NewWSConnector(url string) *WSConnector

func (*WSConnector) Close

func (ws *WSConnector) Close()

func (*WSConnector) CloseWithMsg

func (ws *WSConnector) CloseWithMsg(message string)

func (*WSConnector) Closed

func (ws *WSConnector) Closed() bool

func (*WSConnector) Connect

func (ws *WSConnector) Connect()

func (*WSConnector) OnBinaryMessageReceived

func (ws *WSConnector) OnBinaryMessageReceived(f func(data []byte))

func (*WSConnector) OnBinaryMessageSent

func (ws *WSConnector) OnBinaryMessageSent(f func(data []byte))

func (*WSConnector) OnClose

func (ws *WSConnector) OnClose(f func(code int, text string))

func (*WSConnector) OnConnectError

func (ws *WSConnector) OnConnectError(f func(err error))

func (*WSConnector) OnConnected

func (ws *WSConnector) OnConnected(f func())

func (*WSConnector) OnDisconnected

func (ws *WSConnector) OnDisconnected(f func(err error))

func (*WSConnector) OnPingReceived

func (ws *WSConnector) OnPingReceived(f func(appData string))

func (*WSConnector) OnPongReceived

func (ws *WSConnector) OnPongReceived(f func(appData string))

func (*WSConnector) OnSentError

func (ws *WSConnector) OnSentError(f func(err error))

func (*WSConnector) OnTextMessageReceived

func (ws *WSConnector) OnTextMessageReceived(f func(message string))

func (*WSConnector) OnTextMessageSent

func (ws *WSConnector) OnTextMessageSent(f func(message string))

func (*WSConnector) SendTextBinary

func (ws *WSConnector) SendTextBinary(data []byte) error

func (*WSConnector) SendTextMessage

func (ws *WSConnector) SendTextMessage(message string) error

func (*WSConnector) SetConfig

func (ws *WSConnector) SetConfig(config *Config)

func (*WSConnector) SetDialer

func (ws *WSConnector) SetDialer(dialer *websocket.Dialer)

func (*WSConnector) SetHeader

func (ws *WSConnector) SetHeader(header http.Header)

type WebSocket

type WebSocket struct {
	Url    string
	Conn   *websocket.Conn
	Dialer *websocket.Dialer

	RequestHeader http.Header
	HttpResponse  *http.Response
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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