matrix-spec/content/push-gateway-api.md

67 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

2021-01-19 23:15:46 +01:00
---
title: "Push Gateway API"
weight: 50
type: docs
description: |
Clients may want to receive push notifications when events are received at the
homeserver. This is managed by a distinct entity called the Push Gateway.
2021-01-19 23:15:46 +01:00
---
2021-01-20 00:14:52 +01:00
## Overview
A client's homeserver forwards information about received events to the
push gateway. The gateway then submits a push notification to the push
notification provider (e.g. APNS, GCM).
```nohighlight
2021-01-20 01:41:28 +01:00
+--------------------+ +-------------------+
Matrix HTTP | | | |
Notification Protocol | App Developer | | Device Vendor |
| | | |
+-------------------+ | +----------------+ | | +---------------+ |
| | | | | | | | | |
| Matrix homeserver +-----> Push Gateway +------> Push Provider | |
| | | | | | | | | |
+-^-----------------+ | +----------------+ | | +----+----------+ |
| | | | | |
2021-01-20 00:14:52 +01:00
Matrix | | | | | |
2021-01-20 01:41:28 +01:00
Client/Server API + | | | | |
| | +--------------------+ +-------------------+
| +--+-+ |
| | <-------------------------------------------+
+---+ |
| | Provider Push Protocol
+----+
Mobile Device or Client
```
2021-01-20 00:14:52 +01:00
## API standards
### Unsupported endpoints
If a request for an unsupported (or unknown) endpoint is received then the server
must respond with a 404 `M_UNRECOGNIZED` error.
Similarly, a 405 `M_UNRECOGNIZED` error is used to denote an unsupported method
to a known endpoint.
2021-01-20 00:14:52 +01:00
## Homeserver behaviour
This describes the format used by "HTTP" pushers to send notifications
of events to Push Gateways. If the endpoint returns an HTTP error code,
the homeserver SHOULD retry for a reasonable amount of time using
exponential backoff.
When pushing notifications for events, the homeserver is expected to
include all of the event-related fields in the `/notify` request. When
the homeserver is performing a push where the `format` is
`"event_id_only"`, only the `event_id`, `room_id`, `counts`, and
`devices` are required to be populated.
Note that most of the values and behaviour of this endpoint is described
by the Client-Server API's [Push
2021-01-21 06:45:35 +01:00
Module](/client-server-api#push-notifications).
2021-01-20 00:14:52 +01:00
{{% http-api spec="push-gateway" api="push_notifier" %}}