hooks

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 1 Imported by: 0

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