From be289a96ad3abe1f373517920c89613cf80076a9 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 29 Aug 2013 17:48:31 -0700 Subject: implement a 'ping' message type to respond if we're still here and whether our URL or keys have changed. --- mod/post.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mod/post.php') diff --git a/mod/post.php b/mod/post.php index 847af0fe9..70dd4dc19 100644 --- a/mod/post.php +++ b/mod/post.php @@ -175,6 +175,19 @@ function post_post(&$a) { $msgtype = ((array_key_exists('type',$data)) ? $data['type'] : ''); + if($msgtype === 'ping') { + + // Useful to get a health check on a remote site. + // This will let us know if any important communication details + // that we may have stored are no longer valid, regardless of xchan details. + + $ret['success'] = true; + $ret['site'] = array(); + $ret['site']['url'] = z_root(); + $ret['site']['url_sig'] = base64url_encode(rsa_sign(z_root(),get_config('system','prvkey'))); + $ret['site']['sitekey'] = get_config('system','pubkey'); + json_return_and_die($ret); + } if($msgtype === 'pickup') { -- cgit v1.2.3