envelope

package
v0.56.10 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package envelope is the JSON shape of every message published on <org_id>.<handle>.broadcast (per WIRE.md §3).

Index

Constants

View Source
const MaxBytes = 65536 // 64 KiB cap on the encoded envelope.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	ID           string    `json:"id"`
	Sender       string    `json:"sender"`
	Subject      string    `json:"subject"`
	Payload      string    `json:"payload"`
	CreatedAt    time.Time `json:"created_at"`
	InReplyTo    string    `json:"in_reply_to"`
	AckRequested bool      `json:"ack_requested"`
	// ScheduleID is the short id of the schedule that fired this
	// message (docs/specs/schedule.md) — set only by the server-side
	// scheduler, so receivers can distinguish scheduled messages from
	// live sends. omitempty keeps plain sends wire-identical to old
	// daemons.
	ScheduleID string `json:"schedule_id,omitempty"`
}

Sender is the source handle the message was published *from* — the broadcaster's current source at publish time. Empty string when the publisher had no current source set (e.g. `ppz send <dest>` from a session that never connected). Distinct from the destination handle, which is encoded only in the NATS subject (per WIRE.md §3).

Subject is an optional header-line, separate from the payload. Two roles:

  • User-set: free-form text rendered as `[subject] payload` in the `ppz read` tabular default for inbox-shaped pipes. No CLI surface to set this in v0.23.0 — reserved for the next phase.
  • System-set: subjects starting with `ack:` are reserved for daemon- emitted protocol messages (e.g. `ack:read`) that the read formatter renders specially. Always serialised, even when empty, so receivers see a stable wire shape.

InReplyTo carries the UUID of the message this one is replying to (e.g. the original message's id when the daemon auto-emits an `ack:read`). Empty string when this isn't a reply. Always serialised — receivers see every field, every time.

AckRequested is the sender's opt-in to a daemon-emitted read receipt: when the recipient's `ppz read` advances the cursor past a message with this bit set, the recipient's daemon publishes an `ack:read` envelope back to the sender's `<sender>.inbox`. Best-effort, non- blocking: a failed ack publish does not block cursor advancement.

func New

func New(sender, subject, payload string, now time.Time) Message

func Unmarshal

func Unmarshal(b []byte) (Message, error)

func (Message) Marshal

func (m Message) Marshal() ([]byte, error)

Jump to

Keyboard shortcuts

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