nhooyr

package
v0.0.0-...-f9581dc Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// RequestIDLength size of id sent on WS request
	RequestIDLength = 16
	// CloseMessageCode identifier the message id for a close request
	CloseMessageCode = 1000
	// DefaultTimeout timeout in seconds
	DefaultTimeout = 30
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(ws *WebSocket) error

type WebSocket

type WebSocket struct {
	Conn *nhooyr.Conn

	Timeout time.Duration
	Option  []Option
	// contains filtered or unexported fields
}

func Create

func Create() *WebSocket

func (*WebSocket) Close

func (ws *WebSocket) Close() error

func (*WebSocket) Connect

func (ws *WebSocket) Connect(url string) (conn.Connection, error)

func (*WebSocket) LiveNotifications

func (ws *WebSocket) LiveNotifications(liveQueryID string) (chan model.Notification, error)

func (*WebSocket) Logger

func (ws *WebSocket) Logger(logData logger.Logger) *WebSocket

If path is empty it will use os.stdout/os.stderr

func (*WebSocket) RawLogger

func (ws *WebSocket) RawLogger(logData logger.Logger) *WebSocket

func (*WebSocket) Send

func (ws *WebSocket) Send(method string, params []interface{}) (interface{}, error)

func (*WebSocket) SetCompression

func (ws *WebSocket) SetCompression(compression bool) *WebSocket

func (*WebSocket) SetTimeOut

func (ws *WebSocket) SetTimeOut(timeout time.Duration) *WebSocket

func (*WebSocket) Start

func (ws *WebSocket) Start() error

Jump to

Keyboard shortcuts

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