Skip to main content

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
)

NameTypeDescription
enableModuleSet<Modules>set of modules to initialize
userPrivateKeyStringuser private key used to authorize; generated from: CryptoApi#generatePrivateKey or CryptoApi#derivePrivateKey
solutionIdString`SolutionId` of the current project
platformUrlStringPlatform's Endpoint URL

TypeDescription
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
)

NameTypeDescription
connectionIdLongID 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
)

NameTypeDescription
connectionIdLongId of connection

TypeDescription
PrivmxEndpoint Active connection

getEndpointIDs

Returns set of all active connection's IDs.

public Set<Long> getEndpointIDs()

TypeDescription
Set<Long> set of all active connection's IDs

initialized

Returns initialization state.

public boolean initialized()

TypeDescription
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
)

NameTypeDescription
certsPathStringpath to file with .pem certificate

startListening

Starts event handling Thread.

public void startListening()

stopListening

Stops event loop.

public void stopListening()