webhook

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Upgrader = websocket.Upgrader{
	CheckOrigin: func(r *http.Request) bool { return true },
}

Functions

This section is empty.

Types

type Dispatcher

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

func NewDispatcher

func NewDispatcher(cfg *config.Config) *Dispatcher

func (*Dispatcher) AddWSClient

func (d *Dispatcher) AddWSClient(sessionID string, conn *websocket.Conn)

AddWSClient registers websocket connection for session.

func (*Dispatcher) CloseSession

func (d *Dispatcher) CloseSession(sessionID string)

CloseSession closes all websocket connections for session.

func (*Dispatcher) Emit

func (d *Dispatcher) Emit(sessionID, event string, data any)

func (*Dispatcher) RemoveWSClient

func (d *Dispatcher) RemoveWSClient(sessionID string, conn *websocket.Conn)

RemoveWSClient removes websocket connection.

func (*Dispatcher) StartRetryWorker added in v1.3.0

func (d *Dispatcher) StartRetryWorker()

StartRetryWorker periodically retries queued events.

type Event

type Event struct {
	SessionID string `json:"sessionId"`
	Event     string `json:"event"`
	Data      any    `json:"data,omitempty"`
}

type Queue added in v1.3.0

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

Queue buffers events when webhook delivery fails. Events are retried periodically.

func NewQueue added in v1.3.0

func NewQueue() *Queue

func (*Queue) Drain added in v1.3.0

func (q *Queue) Drain() []Event

func (*Queue) Len added in v1.3.0

func (q *Queue) Len() int

func (*Queue) Push added in v1.3.0

func (q *Queue) Push(evt Event)

Jump to

Keyboard shortcuts

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