PHANTOM REPOSITORY server purpose is to store files and their metadata generated by the different stages/phantom-tools (sources) when running the PHANTOM toolset on different projects.
The objective of this folder is to provide an example of suscription to the websockets service of the REPOSITORY server.
The example consists of a java application which suscribes to JSON updates for some project updates, and some type of source updates.
Following the next steps that java application will report on the screen the reception of the notifications. Such notifications consists of JSON strings updates which are only sent to those who be suscribed.
bash start-es.sh;
bash start-appmanager.sh;
bash ../repo_api_command_line/demo_admin_repo_curl.sh
The suscriber needs to know the server-address and the server-port.
The suscriber needs an authentication token, and perform a websocket subscription.
The subscription in done by a websocket connection to ws://serveraddress:serverport/
and sending a message for each subscription like {"user":"bob@abc.com","project":"demo_hpc"} or {"user":"bob@abc.com", "source":"PT"} where it is identified the project or source for which be notified.
It can be performed as many subscriptions as wished on the same websocket connection.
As an example, the next script performs a doble subscription:
TEST WITH JAVA:
bash test_client_ws_suscriber_repository.sh;
or TEST WITH PYTHON:
python test_client_ws_suscriber_repository.py;
I suggest to run the next strings on a different terminal, or computer, to make it clear what is the feedback to the suscribed client
bash test_repo_update_db.sh;
Demonstration step-by-step video of suscribing with JAVA to notifications to the Repository is available at Demo WS, which is similar to the use of the example in the folder for the suscription on the Repository.
It is mandatory to provide a TOKEN !! The token is a text string, its length in the current implementation is about 162 characters.
In the example is generated a new token from a user id, such "bob@abc.com" and password "1234".
BUT it is expected that users will provide a token, and NOT provide their id neither their password.
-
Who suscribes will get ONLY notifications from the server of the NEW updates. If you suscribe later than some updates, then you will not get those corresponding notifications.
-
If the websocket connection is broken, then the notifications will be lost. The subscriber needs to perform a new connection and new subscription.
-
In case of doubt if a notification is lost, the subscriber can always possible to query for the files or metadata in the Repository.