wsclient

package
v23.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: MIT Imports: 16 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 interface {
	Close() error
	SetReadDeadline(time.Time) error
	ReadMessage() (int, []byte, error)
	WriteMessage(int, []byte) error
}

Conn is the interface for a *websocket.Conn as used in this wrapper package

type Dialer

type Dialer interface {
	Dial(string, http.Header) (Conn, *http.Response, error)
}

Dialer is the interface for a *websocket.Dialer as used in this wrapper package

func WrapDialer

func WrapDialer(d *websocket.Dialer) Dialer

WrapDialer will wrap a *websocket.Dialer so it conforms to this package's interface

type Logger

type Logger = interface {
	Log(keyvals ...interface{}) error
	Message(string, ...interface{})
	Err(string, error, ...interface{})
	Printf(string, ...interface{})
}

type Options

type Options struct {
	MaxConcurrentHandlers int
}

Options enables setting up a WSClient with the desired connection settings

type WSClient

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

func NewWSClient

func NewWSClient(deps dependencies, options Options) *WSClient

NewWSClient creates a new WSClient

func (*WSClient) Close

func (c *WSClient) Close()

func (*WSClient) Connect

func (c *WSClient) Connect(gatewayURL, token string) error

func (*WSClient) HandleRequests

func (c *WSClient) HandleRequests(ctx context.Context, handler wsapi.MessageHandler) error

func (*WSClient) SendMessage

func (c *WSClient) SendMessage(msg wsapi.WSMessage)

func (*WSClient) SetDebug

func (c *WSClient) SetDebug(val bool)

Jump to

Keyboard shortcuts

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