mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 11:30:55 +01:00
Publish additional context to the Aphlict server.
Summary: Ref T4324. As well as sending the key for the notification, also publish the notification type and a list of subscribers to the Aphlict server. The idea here is that the Aphlict server passes anything within the `data` key to the clients, whereas other keys (such as `subscribers`) will be used by the server to determine where the notifications should be routed. Note that these changes don't do anything useful, but are a prerequisite for further work on T4324. Test Plan: Sent myself test notifications at `/notification/status/`. Also inspected the Aphlict server debug output: ``` > sudo ./bin/aphlict --foreground Starting server in foreground, ignoring pidfile... Launching server: $ node '/usr/src/phabricator/support/aphlict/server/aphlict_server.js' --port='22280' --admin='22281' --host='localhost' --user='aphlict' --log='/var/log/aphlict.log' [Thu Jun 05 2014 18:38:14 GMT+0000 (UTC)] Started Server (PID 15437) [Thu Jun 05 2014 18:38:16 GMT+0000 (UTC)] <FlashPolicy> Policy Request From ::ffff:10.0.0.1 [Thu Jun 05 2014 18:38:16 GMT+0000 (UTC)] <Listener/1> Connected from ::ffff:10.0.0.1 [Thu Jun 05 2014 18:38:19 GMT+0000 (UTC)] notification: {"data":{"key":"6021516228036848559","type":"notification"},"subscribers":["PHID-USER-cb5af6p4oepy5tlgqypi"]} [Thu Jun 05 2014 18:38:19 GMT+0000 (UTC)] <Listener/1> Wrote Message ``` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Maniphest Tasks: T4324 Differential Revision: https://secure.phabricator.com/D9396
This commit is contained in:
parent
ac2b91711f
commit
fe98aa6839
3 changed files with 10 additions and 7 deletions
|
@ -175,9 +175,12 @@ final class PhabricatorFeedStoryPublisher {
|
|||
}
|
||||
|
||||
private function sendNotification($chrono_key) {
|
||||
|
||||
$data = array(
|
||||
'key' => (string)$chrono_key,
|
||||
'data' => array(
|
||||
'key' => (string)$chrono_key,
|
||||
'type' => 'notification',
|
||||
),
|
||||
'subscribers' => $this->subscribedPHIDs,
|
||||
);
|
||||
|
||||
try {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
final class PhabricatorNotificationClient {
|
||||
|
||||
const EXPECT_VERSION = 4;
|
||||
const EXPECT_VERSION = 5;
|
||||
|
||||
public static function getServerStatus() {
|
||||
$uri = PhabricatorEnv::getEnvConfig('notification.server-uri');
|
||||
|
|
|
@ -120,9 +120,9 @@ var receive_server = http.createServer(function(request, response) {
|
|||
request.on('end', function () {
|
||||
++messages_in;
|
||||
|
||||
var data = JSON.parse(body);
|
||||
debug.log('notification: ' + JSON.stringify(data));
|
||||
broadcast(data);
|
||||
var msg = JSON.parse(body);
|
||||
debug.log('notification: ' + JSON.stringify(msg));
|
||||
broadcast(msg.data);
|
||||
response.end();
|
||||
});
|
||||
} else if (request.url == '/status/') {
|
||||
|
@ -139,7 +139,7 @@ var receive_server = http.createServer(function(request, response) {
|
|||
'messages.in': messages_in,
|
||||
'messages.out': messages_out,
|
||||
'log': config.log,
|
||||
'version': 4
|
||||
'version': 5
|
||||
};
|
||||
|
||||
response.write(JSON.stringify(status));
|
||||
|
|
Loading…
Reference in a new issue