1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 07:12:41 +01:00
phorge-phorge/webroot/rsrc/js/application
Joshua Spence 84d259cea2 Modify the Aphlict server to transmit messages instead of broadcasting them.
Summary: Ref T4324. Ref T5284. This adds server-side support for keeping track of a set of PHIDs that the Aphlict clients have subscribed to. Instead of broadcasting a notification to all clients (after which the clients can poll `/notification/individual` in order to determine whether or not they are interested in the notification), transmit notifications only to clients that have subscribed to a PHID that is relevant to the notification.

Test Plan:
I opened up two clients on the same host (incognito tabs in Chrome). Here is the output from the server:

```
> sudo ./bin/aphlict debug
Starting Aphlict server in foreground...
Launching server:

    $ 'nodejs' '/usr/src/phabricator/src/applications/aphlict/management/../../../../support/aphlict/server/aphlict_server.js' --port='22280' --admin='22281' --host='localhost' --user='aphlict'

[Wed Jun 11 2014 19:10:27 GMT+0000 (UTC)] Started Server (PID 4546)
[Wed Jun 11 2014 19:10:36 GMT+0000 (UTC)] <FlashPolicy> Policy Request From ::ffff:192.168.1.1
[Wed Jun 11 2014 19:10:37 GMT+0000 (UTC)] <Listener/1> Connected from ::ffff:192.168.1.1
[Wed Jun 11 2014 19:10:37 GMT+0000 (UTC)] <Listener/1> Received data: {"command":"subscribe","data":["PHID-USER-cb5af6p4oepy5tlgqypi"]}
[Wed Jun 11 2014 19:10:37 GMT+0000 (UTC)] <Listener/1> Subscribed to: ["PHID-USER-cb5af6p4oepy5tlgqypi"]
[Wed Jun 11 2014 19:10:39 GMT+0000 (UTC)] <Listener/1> Received data: {"command":"subscribe","data":["PHID-USER-kfohe3ca5oe6ygykmioq"]}
[Wed Jun 11 2014 19:10:39 GMT+0000 (UTC)] <Listener/1> Subscribed to: ["PHID-USER-kfohe3ca5oe6ygykmioq"]
[Wed Jun 11 2014 19:10:42 GMT+0000 (UTC)] notification: {"key":"6023751084283587681","type":"notification","subscribers":["PHID-USER-cb5af6p4oepy5tlgqypi"]}
[Wed Jun 11 2014 19:10:42 GMT+0000 (UTC)] <Listener/1> Wrote Message
```

I verified (using the "Network" tab in Chrome) that an AJAX request to `/notification/individual/` was only made in the tab belonging to the user that triggered the test notification.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5284, T4324

Differential Revision: https://secure.phabricator.com/D9458
2014-06-11 12:17:29 -07:00
..
aphlict Modify the Aphlict server to transmit messages instead of broadcasting them. 2014-06-11 12:17:29 -07:00
auth Add Persona auth provider 2013-10-14 14:34:57 -07:00
config Various linter fixes. 2014-02-26 12:44:58 -08:00
conpherence Use ActionList-based dropdowns in Conpherence 2014-05-05 10:56:38 -07:00
countdown Fix countdown embeds and endless loops on resource loads in Javelin 2014-06-05 17:16:36 -07:00
dashboard Use JS to manage dashboard tab panels 2014-06-11 10:39:23 -07:00
differential Consolidate changeset rendering logic 2014-06-03 18:01:18 -07:00
diffusion Add a SublimeText-style repository typeahead 2014-05-13 14:08:21 -07:00
doorkeeper Various linter fixes. 2014-02-26 12:44:58 -08:00
files Various linter fixes. 2014-02-26 12:44:58 -08:00
harbormaster Various linter fixes. 2014-02-26 12:44:58 -08:00
herald Herald - make tokenizers have the purdy icons 2014-04-10 12:38:15 -07:00
maniphest Despecialize most task status handling 2014-03-25 13:47:42 -07:00
owners Allow excluding paths from package 2012-12-07 16:33:16 -08:00
passphrase Add "allow null" and username hinting to the Passphrase credential control 2013-11-22 14:35:35 -08:00
phame Use JsShrink if jsxmin is not available 2013-05-18 17:04:22 -07:00
pholio Pholio - back end for image re-ordering 2013-08-12 13:09:07 -07:00
phortune Allow PhortuneTestProvider to add payment methods 2013-04-25 09:50:08 -07:00
policy [redesign] Tokens and List 2014-05-28 20:58:22 -07:00
ponder Use PHUIRemarkupPreviewPanel in Ponder 2013-08-05 10:47:06 -07:00
projects Allow workboards to be filtered with ApplicationSearch 2014-05-20 11:42:05 -07:00
releeph Use standard UI elements to render pull requests in Releeph 2014-04-18 06:44:45 -07:00
repository Removed getElementsByClassName in repositor-crossreference.js 2013-05-12 06:54:15 -07:00
search Various linter fixes. 2014-02-26 12:44:58 -08:00
slowvote Use JsShrink if jsxmin is not available 2013-05-18 17:04:22 -07:00
transactions Move all comment management junk into a dropdown menu 2014-05-05 10:57:23 -07:00
uiexample Fix more JavelinView example stuff 2013-07-16 13:46:49 -07:00