Documentation ¶
Index ¶
- Variables
- type Egress
- 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 ConveyDecorator(f func(http.Header) error) Option
- func CredentialsDecorator(f func(http.Header) error) Option
- func DeviceID(id wrp.DeviceID) Option
- func FetchURL(f func(context.Context) (string, error)) Option
- func FetchURLTimeout(d time.Duration) Option
- func HTTPClient(c arrangehttp.ClientConfig) Option
- func HTTPClientWithForceSets(c arrangehttp.ClientConfig) Option
- func InactivityTimeout(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 PingWriteTimeout(d time.Duration) Option
- func RetryPolicy(pf retry.PolicyFactory) Option
- func SendTimeout(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 Egress ¶ added in v0.1.0
type Egress interface { // HandleWrp is called whenever a message targets something other than this device. HandleWrp(m wrp.Message) error }
Egress interface is the egress route used to handle wrp messages that targets something other than this device
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 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 FetchURLTimeout ¶
FetchURLTimeout sets the FetchURLTimeout for the WS connection. If this is not set, the default is 30 seconds.
func HTTPClient ¶ added in v0.1.0
func HTTPClient(c arrangehttp.ClientConfig) Option
HTTPClient is the configuration for the HTTP client used for connection attempts.
func HTTPClientWithForceSets ¶ added in v0.1.0
func HTTPClientWithForceSets(c arrangehttp.ClientConfig) Option
HTTPClientWithForceSets is the configuration for the HTTP client with recommended force sets, used for connection attempts.
func InactivityTimeout ¶ added in v0.1.0
InactivityTimeout sets inactivity timeout for the WS connection.
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 PingWriteTimeout ¶ added in v0.1.0
PingWriteTimeout 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 SendTimeout ¶ added in v0.1.0
SendTimeout sets the send timeout for the WS connection.
type Websocket ¶
type Websocket struct {
// contains filtered or unexported fields
}
func (*Websocket) AddMessageListener ¶ added in v0.1.0
func (ws *Websocket) AddMessageListener(listener event.MsgListener) event.CancelFunc
AddMessageListener adds a message listener to the WS connection. The listener will be called for every message received from the WS.
func (*Websocket) Send ¶
Send sends the provided WRP message through the existing websocket. This call synchronously blocks until the write is complete.