websocket

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 11 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 struct {
	// contains filtered or unexported fields
}

Conn implements a net.Conn using WebSockets as the underlying transport.

This adds a small amount of overhead compared to using TCP directly, though it means the connection can be used with HTTP servers and load balancers.

func Dial

func Dial(ctx context.Context, url string, opts ...DialOption) (*Conn, error)

func New

func New(wsConn *websocket.Conn) *Conn

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

type DialOption

type DialOption interface {
	// contains filtered or unexported methods
}

func WithTLSConfig

func WithTLSConfig(config *tls.Config) DialOption

func WithToken

func WithToken(token string) DialOption

type RetryableError

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

RetryableError indicates a error is retryable.

func NewRetryableError

func NewRetryableError(err error) *RetryableError

func (*RetryableError) Error

func (e *RetryableError) Error() string

func (*RetryableError) Unwrap

func (e *RetryableError) Unwrap() error

Jump to

Keyboard shortcuts

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