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.
Click to show internal directories.
Click to hide internal directories.