httphandler

package
v1.8.20 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 13 Imported by: 5 modules, 5 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.

README

Broadcaster API

Change Operations

Changes are streamed to a client as they happen, such as to the rows of the server's tables.

  • Each change has an action, which is create, update or delete.
  • It has the schema and table which changed, and the row, or rows, which changed, such as by an identifier, when it says.
  • It has data when the table says more of the change, such as a row's new serial, {"serial":3}.
  • The server says which schemas and tables it publishes changes of.
GET /changes

Watch the changes, as a stream of server-sent events, until the client closes the connection.

  • Each change is a change event, whose data is the change, as JSON, such as {"action":"create","schema":"llm","table":"provider","row":"ollama"}.
  • With schema, table or action, only the changes with them are streamed, such as ?table=session&action=update. Each matches any when it's left out.
  • The stream is watching once it has started, so a client which then loads what it shows misses no changes.
  • A client which falls behind is sent a rescan of each table it missed changes of: an update of the table, without a row, so it loads the table again.
  • When the server is stopping, a shutdown event is sent, and the stream ends, as there will be no more changes, within a second, even when the client stopped reading.
  • A client which doesn't read its changes has up to 16 kept for it, and misses those after them.
  • Returns 400 if the action isn't create, update or delete, 406 if the client doesn't accept text/event-stream, or 503 if the server is stopping.

Documentation

Overview

Package httphandler has the broadcaster's HTTP API, which streams its changes to clients

Index

Constants

View Source
const Tag = "Changes"

Tag is the tag of the broadcaster's API, which a server with tag groups adds to one of them, as Redoc doesn't show a tag which isn't in a group, once there are groups, such as with:

router.Spec().AddTagGroup("Server", httphandler.Tag)

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(b *broadcaster.Broadcaster, router *httprouter.Router) error

RegisterHandlers registers the broadcaster's API with the router, which streams its changes at changes, with Tag

Types

This section is empty.

Jump to

Keyboard shortcuts

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