summary refs log tree commit diff
path: root/synapse/appservice
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2023-03-16 16:00:03 +0200
committerGitHub <noreply@github.com>2023-03-16 15:00:03 +0100
commitb0a0fb5c97449720c679045f1bb5a5f393b1c267 (patch)
tree01ff31ed09ba5a9538cd823d21b88723ab347080 /synapse/appservice
parentRefresh remote profiles that have been marked as stale, in order to fill the ... (diff)
downloadsynapse-b0a0fb5c97449720c679045f1bb5a5f393b1c267.tar.xz
Implement MSC2659: application service ping endpoint (#15249)
Signed-off-by: Tulir Asokan <tulir@maunium.net>
Diffstat (limited to 'synapse/appservice')
-rw-r--r--synapse/appservice/api.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py
index 1a6f69e7d3..4812fb4496 100644
--- a/synapse/appservice/api.py
+++ b/synapse/appservice/api.py
@@ -266,6 +266,19 @@ class ApplicationServiceApi(SimpleHttpClient):
         key = (service.id, protocol)
         return await self.protocol_meta_cache.wrap(key, _get)
 
+    async def ping(self, service: "ApplicationService", txn_id: Optional[str]) -> None:
+        # The caller should check that url is set
+        assert service.url is not None, "ping called without URL being set"
+
+        # This is required by the configuration.
+        assert service.hs_token is not None
+
+        await self.post_json_get_json(
+            uri=service.url + "/_matrix/app/unstable/fi.mau.msc2659/ping",
+            post_json={"transaction_id": txn_id},
+            headers={"Authorization": [f"Bearer {service.hs_token}"]},
+        )
+
     async def push_bulk(
         self,
         service: "ApplicationService",