A simple ServerChooser that keeps a list of AMPS instances and Authenticators, and advances to the next one when failure occurs.
More...
A simple ServerChooser that keeps a list of AMPS instances and Authenticators, and advances to the next one when failure occurs.
// Create the client
HAClient client = new HAClient("CompositeSubber");
try
{
// Add URIs and connect the client
DefaultServerChooser sc = new DefaultServerChooser();
sc.add("tcp://127.0.0.1:9027/amps/composite-json-binary");
client.setServerChooser(sc);
client.connectAndLogon();
◆ DefaultServerChooser()
AMPS.Client.DefaultServerChooser.DefaultServerChooser |
( |
| ) |
|
|
inline |
◆ add()
Adds a URI to self.
- Parameters
-
uri | The AMPS URI to add to the list. |
◆ addAll< T >()
Adds URIs to self.
- Parameters
-
uris | The AMPS URIs to add to the list. |
◆ getCurrentAuthenticator()
virtual Authenticator AMPS.Client.DefaultServerChooser.getCurrentAuthenticator |
( |
| ) |
|
|
inlinevirtual |
◆ getCurrentURI()
virtual string AMPS.Client.DefaultServerChooser.getCurrentURI |
( |
| ) |
|
|
inlinevirtual |
◆ getError()
virtual String AMPS.Client.DefaultServerChooser.getError |
( |
| ) |
|
|
inlinevirtual |
Provides additional details to be included in an exception thrown when the AMPS instance(s) are not available. Called by HAClient when creating an exception.
- Returns
- A String with information about the connection that failed and the reason for the failure. When no further information is available, returns an empty string.
Implements AMPS.Client.ServerChooser.
◆ next()
virtual void AMPS.Client.DefaultServerChooser.next |
( |
| ) |
|
|
inlinevirtual |
Moves to the next server in the list of URIs.
◆ reportFailure()
virtual void AMPS.Client.DefaultServerChooser.reportFailure |
( |
Exception |
exception, |
|
|
ConnectionInfo |
ci |
|
) |
| |
|
inlinevirtual |
Called by HAClient when an error occurs connecting to the current URI, and/or when an error occurs logging on. Implementors will likely advance the current URI to the next one in a list, or choose to stay with the current one, based on the exception type.
- Parameters
-
exception | The exception associated with this failure. |
ci | Information about the connection that failed. |
Implements AMPS.Client.ServerChooser.
◆ reportSuccess()
virtual void AMPS.Client.DefaultServerChooser.reportSuccess |
( |
ConnectionInfo |
ci | ) |
|
|
inlinevirtual |
Handles the report of a successful connection.
- Parameters
-
ci | Information about the successful connection. |
Implements AMPS.Client.ServerChooser.
The documentation for this class was generated from the following file:
- AMPS.Client/DefaultServerChooser.cs