callbacks

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RetryCount   = 5
	RetryWaitMin = 1 * time.Second
	RetryWaitMax = 30 * time.Second

	RequestTimeout = 10 * time.Second
)

Configuration

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(req *Request)

Dispatch creates a new http client instance and makes a request to the callback URL.

Each dispatch will spawn a new goroutine. This is a naive implementation and might need to be moved to a worker pool.

Types

type Callback

type Callback interface {
	Validate() error
	Encode() string
}

Callback interface provides a Validate and an Encode method.

type OnRecordingReady

type OnRecordingReady struct {
	SignedParameters string `json:"signed_parameters" form:"signed_parameters"`
}

OnRecordingReady is a callback request with a `signed_parameters` payload.

func (*OnRecordingReady) Encode

func (r *OnRecordingReady) Encode() string

Encode encodes the callback request as Form-Encoded data.

func (*OnRecordingReady) Validate

func (r *OnRecordingReady) Validate() error

Validate checks an OnRecordingReady request

type Request

type Request struct {
	// The callback URL
	URL string

	// Callback is any type of payload
	Callback Callback
}

Request describes a callback invocation.

func NewRequest

func NewRequest(url string, cb Callback) *Request

NewRequest creates a new request.

Jump to

Keyboard shortcuts

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