Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type WSClient ¶
type WSClient interface {
Connect() error
Receive() <-chan []byte
URL() string
SetURL(url string)
Send(ctx context.Context, message []byte) error
Close()
}
func New ¶
func New(ctx context.Context, config *WSConfig, beforeConnect WSPreConnectHandler, afterConnect WSPostConnectHandler) (WSClient, error)
type WSConfig ¶
type WSConfig struct {
HTTPURL string `json:"httpUrl,omitempty"`
WSKeyPath string `json:"wsKeyPath,omitempty"`
ReadBufferSize int `json:"readBufferSize,omitempty"`
WriteBufferSize int `json:"writeBufferSize,omitempty"`
InitialDelay time.Duration `json:"initialDelay,omitempty"`
MaximumDelay time.Duration `json:"maximumDelay,omitempty"`
InitialConnectAttempts int `json:"initialConnectAttempts,omitempty"`
AuthUsername string `json:"authUsername,omitempty"`
AuthPassword string `json:"authPassword,omitempty"`
HTTPHeaders fftypes.JSONObject `json:"headers,omitempty"`
HeartbeatInterval time.Duration `json:"heartbeatInterval,omitempty"`
}
type WSPostConnectHandler ¶
WSPostConnectHandler will be called after every connect/reconnect. Can send data over ws, but must not block listening for data on the ws.
type WSPreConnectHandler ¶ added in v0.13.0
WSPreConnectHandler will be called before every connect/reconnect. Any error returned will prevent the websocket from connecting.
Click to show internal directories.
Click to hide internal directories.