hooks

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: AGPL-3.0 Imports: 1 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 hooks exposes places in Dendrite where custom code can be executed, useful for MSCs. Hooks can only be run in monolith mode.

Index

Constants

View Source
const (
	// KindNewEventPersisted is a hook which is called with *types.HeaderedEvent
	// It is run when a new event is persisted in the roomserver.
	// Usage:
	//   hooks.Attach(hooks.KindNewEventPersisted, func(headeredEvent interface{}) { ... })
	KindNewEventPersisted = "new_event_persisted"
	// KindNewEventReceived is a hook which is called with *types.HeaderedEvent
	// It is run before a new event is processed by the roomserver. This hook can be used
	// to modify the event before it is persisted by adding data to `unsigned`.
	// Usage:
	//   hooks.Attach(hooks.KindNewEventReceived, func(headeredEvent interface{}) {
	//     ev := headeredEvent.(*types.HeaderedEvent)
	//     _ = ev.SetUnsignedField("key", "val")
	//   })
	KindNewEventReceived = "new_event_received"
)

Variables

This section is empty.

Functions

func Attach

func Attach(kind string, callback func(interface{}))

Attach a hook

func Enable

func Enable()

Enable all hooks. This may slow down the server slightly. Required for MSCs to work.

func Run

func Run(kind string, data interface{})

Run any hooks

Types

This section is empty.

Jump to

Keyboard shortcuts

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