Documentation ¶
Index ¶
- Variables
- type Option
- func AddConnectListener(listener event.ConnectListener, cancel ...*event.CancelFunc) Option
- func AddDisconnectListener(listener event.DisconnectListener, cancel ...*event.CancelFunc) Option
- func AddHeartbeatListener(listener event.HeartbeatListener, cancel ...*event.CancelFunc) Option
- func AddMessageListener(listener event.MsgListener, cancel ...*event.CancelFunc) Option
- func AdditionalHeaders(headers http.Header) Option
- func ConnectTimeout(d time.Duration) Option
- func CredentialsDecorator(f func(http.Header) error) Option
- func DeviceID(id wrp.DeviceID) Option
- func ExpectContinueTimeout(d time.Duration) Option
- func FetchURL(f func(context.Context) (string, error)) Option
- func FetchURLTimeout(d time.Duration) Option
- func IdleConnTimeout(d time.Duration) Option
- func KeepAliveInterval(d time.Duration) Option
- func MaxMessageBytes(bytes int64) Option
- func NowFunc(f func() time.Time) Option
- func Once(once ...bool) Option
- func PingInterval(d time.Duration) Option
- func PingTimeout(d time.Duration) Option
- func RetryPolicy(pf retry.PolicyFactory) Option
- func TLSHandshakeTimeout(d time.Duration) Option
- func URL(url string) Option
- func WithIPv4(with ...bool) Option
- func WithIPv6(with ...bool) Option
- type Websocket
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is a functional option type for WS.
func AddConnectListener ¶
func AddConnectListener(listener event.ConnectListener, cancel ...*event.CancelFunc) Option
AddConnectListener adds a connect listener to the WS connection.
func AddDisconnectListener ¶
func AddDisconnectListener(listener event.DisconnectListener, cancel ...*event.CancelFunc) Option
AddDisconnectListener adds a disconnect listener to the WS connection.
func AddHeartbeatListener ¶
func AddHeartbeatListener(listener event.HeartbeatListener, cancel ...*event.CancelFunc) Option
AddHeartbeatListener adds a heartbeat listener to the WS connection.
func AddMessageListener ¶
func AddMessageListener(listener event.MsgListener, cancel ...*event.CancelFunc) Option
AddMessageListener adds a message listener to the WS connection. The listener will be called for every message received from the WS.
func AdditionalHeaders ¶
AdditionalHeaders sets the additional headers for the WS connection.
func ConnectTimeout ¶
ConnectTimeout sets the timeout for the WS connection. If this is not set, the default is 30 seconds.
func CredentialsDecorator ¶
CredentialsDecorator provides the credentials decorator for the WS connection.
func DeviceID ¶
func DeviceID(id wrp.DeviceID) Option
DeviceID sets the device ID for the WS connection.
func ExpectContinueTimeout ¶
ExpectContinueTimeout sets the expect continue timeout for the WS connection. If this is not set, the default is 1 second.
func FetchURLTimeout ¶
FetchURLTimeout sets the FetchURLTimeout for the WS connection. If this is not set, the default is 30 seconds.
func IdleConnTimeout ¶
IdleConnTimeout sets the idle connection timeout for the WS connection. If this is not set, the default is 10 seconds.
func KeepAliveInterval ¶
KeepAliveInterval sets the keep alive interval for the WS connection. If this is not set, the default is 30 seconds.
func MaxMessageBytes ¶
MaxMessageBytes sets the maximum message size sent or received in bytes.
func PingInterval ¶
PingInterval sets the time expected between PINGs for the WS connection. If this is not set, the default is 30 seconds.
func PingTimeout ¶
PingTimeout sets the maximum time allowed between PINGs for the WS connection before the connection is closed. If this is not set, the default is 90 seconds.
func RetryPolicy ¶
func RetryPolicy(pf retry.PolicyFactory) Option
RetryPolicy sets the retry policy factory used for delaying between retry attempts for reconnection.
func TLSHandshakeTimeout ¶
TLSHandshakeTimeout sets the TLS handshake timeout for the WS connection. If this is not set, the default is 10 seconds.
type Websocket ¶
type Websocket struct {
// contains filtered or unexported fields
}
func (*Websocket) Send ¶
Send sends the provided WRP message through the existing websocket. This call synchronously blocks until the write is complete.