-
Notifications
You must be signed in to change notification settings - Fork 1
HubManagement
A hub is a remote entity that allows peer encounter of long wide area networks and routed protocols, e.g. IP, see ASAPHub wiki.
In ASAPHub terms: We are on peer side. We want our peer establish a new connection to another peer over a hub. First, we need a connection to a hub.
SharkPeer sharkPeer = …; // discussed previous sections
HubConnectorDescription hubDescription = TCPHubConnectorDescription(“localhost”, 7070, true);
sharkPeer.addHubDescription(HubConnectorDescription hubDescription);We introduced a concept of hub descriptions. It describes how to connect to a hub.
A hub is provides an open port 7070 via TCP in our example. The final true set the multichannel option on. A new TCP connection is established for each peer encounter. This peer can communicate with more than one peer. There are more than one connection to the hub. You decide in your application context if either of both is an advantage, a disadvantage or neither.
Descriptions can be removed yb calling removeHubDescription(hubDescription).
Hub connections are described with a SharkPeer instance. Connections can establish in any subclass of ASAPActivity:
YourActivity extends ASAPActivity {
...
// connect all described hubs
this.connectASAPHubs();
...
// disconnect from all hubs
this.disconnectASAPHubs();
...
}Note: Adding and removing hub descriptions can have an effect on open hub descriptions:
Hub descriptions are defined on application side and are transmitted to service side of this library. A synchronization is performed whenever a change occurs. It is tested of each open hub connections is still in our hub description list. Connection is closed if this is not the case.