contracts

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gorcure

type Gorcure interface {
	// Publish sends data to a single topic and returns the event id assigned by the hub.
	Publish(topic string, data any) (string, error)
	// PublishUpdate sends a fully described update (multiple topics, private, etc.).
	PublishUpdate(update Update) (string, error)
}

Gorcure is the public API for publishing real-time updates to a Mercure hub.

type Update

type Update struct {
	// Topics the update is published to. At least one is required.
	Topics []string
	// Data is the payload sent to subscribers (already serialized, usually JSON).
	Data string
	// Private marks the update as private; only subscribers authorized for one of
	// the topics (via their JWT) will receive it.
	Private bool
	// ID is an optional SSE event id. When empty the hub generates one.
	ID string
	// Type is an optional SSE event type.
	Type string
	// Retry is the optional SSE reconnection time in milliseconds.
	Retry int
}

Update represents a single message published to one or more Mercure topics.

Jump to

Keyboard shortcuts

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