PrivmxEndpointContainer
Manages certificates, Platform sessions, and active connections. Implements event loop that can be started using #startListening(). Contains instance of CryptoApi.
Constructors
PrivmxEndpointContainer
Creates instance of `PrivmxEndpointContainer`.
public void PrivmxEndpointContainer()
Fields
cryptoApi
Instance of CryptoApi.
public final CryptoApi cryptoApi
Methods
close
Closes event loop.
public void close()
connect
Creates a new connection.
public PrivmxEndpoint connect(
Set<Modules> enableModule,
String userPrivateKey,
String solutionId,
String platformUrl
)
Name | Type | Description |
---|---|---|
enableModule | Set<Modules> | set of modules to initialize |
userPrivateKey | String | user private key used to authorize; generated from: CryptoApi#generatePrivateKey or CryptoApi#derivePrivateKey |
solutionId | String | `SolutionId` of the current project |
platformUrl | String | Platform's Endpoint URL |
Type | Description |
---|---|
PrivmxEndpoint | Created connection |
disconnect
Disconnects connection matching given `connectionId` and removes it from the container. This method is recommended for disconnecting connections by their ID from the container.
public void disconnect(
Long connectionId
)
Name | Type | Description |
---|---|---|
connectionId | Long | ID of the connection |
disconnectAll
Disconnects all connections and removes them from the container.
public void disconnectAll()
getEndpoint
Returns connection matching given `connectionId`.
public PrivmxEndpoint getEndpoint(
Long connectionId
)
Name | Type | Description |
---|---|---|
connectionId | Long | Id of connection |
Type | Description |
---|---|
PrivmxEndpoint | Active connection |
getEndpointIDs
Returns set of all active connection's IDs.
public Set<Long> getEndpointIDs()
Type | Description |
---|---|
Set<Long> | set of all active connection's IDs |
initialized
Returns initialization state.
public boolean initialized()
Type | Description |
---|---|
boolean | `true` if path to certificate is set successfully |
setCertsPath
Sets path to the certificate used to create a secure connection to PrivMX Bridge. It checks whether a .pem file with certificate exists in `certsPath` and uses it if it does. If it does not, it installs the default PrivMX certificate.
public void setCertsPath(
String certsPath
)
Name | Type | Description |
---|---|---|
certsPath | String | path to file with .pem certificate |
startListening
Starts event handling Thread.
public void startListening()
stopListening
Stops event loop.
public void stopListening()