webhook

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventRoomStarted       = "room_started"
	EventRoomFinished      = "room_finished"
	EventParticipantJoined = "participant_joined"
	EventParticipantLeft   = "participant_left"
	EventTrackPublished    = "track_published"
	EventTrackUnpublished  = "track_unpublished"
	EventEgressStarted     = "egress_started"
	EventEgressUpdated     = "egress_updated"
	EventEgressEnded       = "egress_ended"
	EventIngressStarted    = "ingress_started"
	EventIngressEnded      = "ingress_ended"
)

Variables

View Source
var (
	ErrNoAuthHeader    = errors.New("authorization header could not be found")
	ErrSecretNotFound  = errors.New("API secret could not be found")
	ErrInvalidChecksum = errors.New("could not verify authenticity of message")
)

Functions

func Receive

func Receive(r *http.Request, provider auth.KeyProvider) ([]byte, error)

Receive reads and verifies incoming webhook is signed with key/secret pair closes body after reading

func ReceiveWebhookEvent

func ReceiveWebhookEvent(r *http.Request, provider auth.KeyProvider) (*livekit.WebhookEvent, error)

ReceiveWebhookEvent reads and verifies incoming webhook, and returns a parsed WebhookEvent

Types

type DefaultNotifier

type DefaultNotifier struct {
	// contains filtered or unexported fields
}

func (*DefaultNotifier) QueueNotify

func (n *DefaultNotifier) QueueNotify(_ context.Context, event *livekit.WebhookEvent) error

func (*DefaultNotifier) Stop

func (n *DefaultNotifier) Stop(force bool)

type QueuedNotifier

type QueuedNotifier interface {
	QueueNotify(ctx context.Context, event *livekit.WebhookEvent) error
}

func NewDefaultNotifier

func NewDefaultNotifier(apiKey, apiSecret string, urls []string) QueuedNotifier

type URLNotifier

type URLNotifier struct {
	// contains filtered or unexported fields
}

URLNotifier is a QueuedNotifier that sends a POST request to a Webhook URL. It will retry on failure, and will drop events if notification fall too far behind

func NewURLNotifier

func NewURLNotifier(params URLNotifierParams) *URLNotifier

func (*URLNotifier) QueueNotify

func (n *URLNotifier) QueueNotify(event *livekit.WebhookEvent) error

func (*URLNotifier) SetKeys

func (n *URLNotifier) SetKeys(apiKey, apiSecret string)

func (*URLNotifier) Stop

func (n *URLNotifier) Stop(force bool)

type URLNotifierParams

type URLNotifierParams struct {
	Logger    logger.Logger
	QueueSize int
	URL       string
	APIKey    string
	APISecret string
}

Jump to

Keyboard shortcuts

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