Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrConnClosed = errors.New("connection closed") ErrFailedToSend = errors.New("failed to send message") )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithCloseListener ¶
WithCloseListener sets the function to call when the connection is closed. If cancel is provided, it will be populated with a function that can be used to remove the listener.
func WithSendTimeout ¶
WithSendTimeout sets the timeout for sending messages.
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender is a simple connection to an external service. It is safe for concurrent use.
func New ¶
New creates a new Sender. The Sender is not connected to the remote service until Dial() is called. The Sender is safe for concurrent use. The option WithURL is required.
func (*Sender) Close ¶
Close closes the connection to the remote service. This method is idempotent.
func (*Sender) ProcessWRP ¶
ProcessWRP sends a WRP message to the remote service. The context is used to set a timeout for the send operation. If the context is canceled, the send operation will fail with a context.Canceled error. If the connection is closed, the send operation will fail with ErrConnClosed. If the send operation fails for any other reason, the error will be wrapped with ErrFailedToSend. ProcessWRP will never return wrp.ErrNotHandled.