2021-09-14 11:17:25 +02:00
# UnifiedPush over XMPP
2021-09-15 23:31:26 +02:00
[![DroneCI ](https://ci.sum7.eu/api/badges/genofire/unified-push-xmpp/status.svg?branch=main )](https://ci.sum7.eu/genofire/unified-push-xmpp)
[![Go Report Card ](https://goreportcard.com/badge/dev.sum7.eu/genofire/unified-push-xmpp )](https://goreportcard.com/report/dev.sum7.eu/genofire/unified-push-xmpp)
[![Go Reference ](https://pkg.go.dev/badge/dev.sum7.eu/genofire/unified-push-xmpp.svg )](https://pkg.go.dev/dev.sum7.eu/genofire/unified-push-xmpp)
2021-09-14 11:17:25 +02:00
2021-09-16 01:04:43 +02:00
[UnifiedPush ](https://unifiedpush.org/ ) is an specification how push notifications delieveries between application server and application.
This is an implementation of the UnifiedPush specifications to delievere push notification over XMPP.
2021-09-14 11:17:25 +02:00
In this project has following components:
- **Gateway** (also called an Push Provider or [Server ](https://unifiedpush.org/spec/server/ )) which could be registered as an XMPP Component on an Server
2021-09-16 01:04:43 +02:00
- **Distributor** for Linux using the [D-Bus Specification ](https://unifiedpush.org/spec/dbus/ ) which implement an very small XMPP-Client to receive the push notifications
2021-09-14 11:17:25 +02:00
## XMPP Messages
### Register
Request for Register
```xml
< iq from = "push-distributer@example.org/device" to = "up.chat.sum7.eu" type = "set" id = "register-id" >
< register xmlns = 'unifiedpush.org' >
2021-09-14 21:55:21 +02:00
< token > pubic-token< / token >
2021-09-14 11:17:25 +02:00
< / register >
< / iq >
```
**Responses**
on success:
```xml
< iq from = "push-distributer@example.org/device" to = "up.chat.sum7.eu" type = "result" id = "register-id" >
< register xmlns = 'unifiedpush.org' >
2021-09-14 21:55:21 +02:00
< endpoint > https://an-endpoint-for-application-server.localhost/UP?token=endpoint-token< / endpoint >
2021-09-14 11:17:25 +02:00
< / register >
< / iq >
```
on failure:
```xml
< iq from = "push-distributer@example.org/device" to = "up.chat.sum7.eu" type = "error" id = "register-id" >
< register xmlns = 'unifiedpush.org' >
< error > a reason of failure< / error >
< / register >
< / iq >
```
### Unregister
TODO
### Notification
For the push notification it-self the origin `<message/>` is used with following Position of Token and Content.
```xml
< message from = "up.chat.sum7.eu" to = "push-distributer@example.org/device" id = "message-id" >
2021-09-14 21:55:21 +02:00
< subject > public-token< / subject >
2021-09-14 11:17:25 +02:00
< body > Here is the Notification content< / body >
< / message >
```
2021-09-16 01:04:43 +02:00
The message sender `from` should be validated from distributor, for not receiving invalid or manipulated push Messages.
2021-09-14 11:17:25 +02:00
## Wordings
We are using over the complete system three kind of **tokens** :
2021-09-14 21:37:37 +02:00
- **Endpoint Token** which is part of the *Endpoint* and is for using between Gateway and Application-Server
- **Public Token** which is used between Gateway and Distributor
- **App Token** which is used between Distributor and Application