You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Plugins are currently only supported on Linux and MacOS due to a current limitation of golang.
7
+
8
+
## Description
9
+
10
+
_This documentation is generally designed for plugin developers. If you just wanted to use an existing plugin, you would need to refer to the documentation from the plugin maintainer._
11
+
12
+
Gotify provides built-in plugin functionality built on top of the [go plugin system](https://godoc.org/plugin). It is built for extending Gotify functionality.
13
+
14
+
## Get Started
15
+
16
+
First let's see a minimal example of gotify plugin, you can copy this boilerplate code to bootstrap your own plugin:
This program exports two functions: `GetGotifyPluginInfo` and `NewGotifyPluginInstance`, gotify will use these to obtain the plugin metadata and create plugin instances for each user.
57
+
58
+
The `GetGotifyPluginInfo` must return a [`plugin.Info`](https://godoc.org/github.com/gotify/plugin-api#Info) containing descriptive info of the current plugin, all fields are optional except `ModulePath`(the module path of this plugin), which is used to distinguish different plugins.
59
+
60
+
The `NewGotifyPluginInstance` is called with a [`plugin.UserContext`](https://godoc.org/github.com/gotify/plugin-api#UserContext) for each user at startup and every time a new user is added, the plugin must return a plugin instance that satisfies [`plugin.Plugin`](https://godoc.org/github.com/gotify/plugin-api#Plugin) interface.
61
+
More functionalities can be implemented by implementing more interfaces in the [`plugin-api`](https://godoc.org/github.com/gotify/plugin-api#Info) package.
Copy file name to clipboardExpand all lines: docs/plugin.md
+57-39Lines changed: 57 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,14 @@ id: plugin
3
3
title: Intro to Gotify Plugins
4
4
---
5
5
6
-
> Plugins are currently only supported on Linux and MacOS due to a current limitation of golang.
7
-
8
6
## Description
9
7
10
8
_This documentation is generally designed for plugin developers. If you just wanted to use an existing plugin, you would need to refer to the documentation from the plugin maintainer._
11
9
12
-
Gotify provides built-in plugin functionality built on top of the [go plugin system](https://godoc.org/plugin). It is built for extending Gotify functionality.
10
+
Gotify plugins are platform executables that use the gRPC architecture and contains two core behaviors:
11
+
12
+
- Establishing a secure socket connection to the server through a certificate exchange (abbreviated as `kex` in API and protocol documentation).
13
+
- Act as a gRPC server that responds to requests from the server and provides updates to the user's state.
13
14
14
15
## Features
15
16
@@ -27,51 +28,68 @@ Gotify provides built-in plugin functionality built on top of the [go plugin sys
27
28
- Extending the WebUI functionality.
28
29
- Delivering alarm notifications.
29
30
30
-
## Get Started
31
+
## Architecture
31
32
32
-
First let's see a minimal example of gotify plugin, you can copy this boilerplate code to bootstrap your own plugin:
33
+
- gRPC based, plugin is the "server" and gotify/server is the "client".
34
+
- each user gets a long-running server-streaming RPC.
35
+
- Backwards compatibility is provided by:
36
+
- Using optional fields in the `RunUserInstanceServer` initialization request.
37
+
- Using separate RPCs for functionally disjoint features. So the call interface can be extended without pushing breaking changes to the whole RPC schema.
This program exports two functions: `GetGotifyPluginInfo` and `NewGotifyPluginInstance`, gotify will use these to obtain the plugin metadata and create plugin instances for each user.
73
88
74
-
The `GetGotifyPluginInfo` must return a [`plugin.Info`](https://godoc.org/github.com/gotify/plugin-api#Info) containing descriptive info of the current plugin, all fields are optional except `ModulePath`(the module path of this plugin), which is used to distinguish different plugins.
89
+
### Manual Implementation in your favorite Language/Scaffold
90
+
91
+
We support "duck-typed" plugins (i.e. plugins that loosely behave like one built using the Go template), namely it has to provide two functions:
92
+
- A TLS key exchange using secure file descriptors at startup.
93
+
- A long running gRPC server that instantiates a server-side stream for each user session.
75
94
76
-
The `NewGotifyPluginInstance` is called with a [`plugin.UserContext`](https://godoc.org/github.com/gotify/plugin-api#UserContext) for each user at startup and every time a new user is added, the plugin must return a plugin instance that satisfies [`plugin.Plugin`](https://godoc.org/github.com/gotify/plugin-api#Plugin) interface.
77
-
More functionalities can be implemented by implementing more interfaces in the [`plugin-api`](https://godoc.org/github.com/gotify/plugin-api#Info) package.
95
+
The protobuf files are located in [gotify/plugin-api](https://github.com/gotify/plugin-api) repository.
0 commit comments