Skip to content

Quickstart Guide

Marvin edited this page May 30, 2023 · 5 revisions

This guide shows how to get started with ASAPPeers and the ASAPHub using the HubTester application. Each HubTester instance represents one ASAPPeer. The application creates a ASAPPeer and uses HubConnectionManager to establish a connection to the ASAPHub.

The implementation of the HubTester.java is also a good reference for how to get started with ASAPPeers, the EncounterManager and the HubConnectionManager.

1. Launch the ASAPHub

  • clone the ASAPHub repository on your local machine
  • start a hub instance using a pre-build jar, maven or Docker
  • after the hub was started, the IP-address of the hub is printed to console
    • e.g. start TCP hub on 192.168.10.23:6910

2. Start the HubTester instances

  • run mvn clean package -DskipTests
    • the .jar file of the HubTester is located at target/ASAPHub-hub-tester.jar
  • alternatively, you can get the HubTester from the latest ASAPHub release
  • start the first HubTester on machine A:
    • java -jar ASAPHub-hub-tester.jar --host 192.168.10.23 --port 6910 --peerId peer1 --uri asap://exampleURI1 --log log.1.txt --send hello_from_peer_1 5 2000 --multiChannel true --format ASAP_EXAMPLE_APP
  • start the second HubTester on machine B:
    • java -jar ASAPHub-hub-tester.jar --host 192.168.10.23 --port 6910 --peerId peer2 --uri asap://exampleURI2 --log log.1.txt --send hello_from_peer_2 5 2000 --multiChannel true --format ASAP_EXAMPLE_APP
  • each HubTester instantiates one ASAPPeer

After the hub and both HubTester were started, the console output of the HubTester on machine A should look like this:

peer1: activate online messages on that peer
ASAPEngineFS(owner: peer1 | oldestEra: 0 | era: 0 | routing: true): (ASAP_EXAMPLE_APP) created new online message sender
sending message 'hello_from_peer_1_000'
sending message 'hello_from_peer_1_001'
sending message 'hello_from_peer_1_002'
sending message 'hello_from_peer_1_003'
sending message 'hello_from_peer_1_004'
peer1: received message from peer 'peer2' (ASAP_EXAMPLE_APP|asap://exampleURI): hello_from_peer_2_000 
peer1: received message from peer 'peer2' (ASAP_EXAMPLE_APP|asap://exampleURI): hello_from_peer_2_001 
peer1: received message from peer 'peer2' (ASAP_EXAMPLE_APP|asap://exampleURI): hello_from_peer_2_002 
peer1: received message from peer 'peer2' (ASAP_EXAMPLE_APP|asap://exampleURI): hello_from_peer_2_003 
peer1: received message from peer 'peer2' (ASAP_EXAMPLE_APP|asap://exampleURI): hello_from_peer_2_004 

Congratulations! You build your first ASAP Ad-Hoc network using two ASAPPeers and one ASAPHub.

The HubTester can be used for health check and demo use cases. Furthermore, it's also possible to create small load tests. For this purpose you could launch e.g. 10 HubTester instances sending one message every 0.5 seconds from each instance.

Clone this wiki locally