java.lang.Object
io.mokamint.node.service.PublicNodeServices
A provider of node services for the public API of a node.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PublicNodeServiceopen(PublicNode node, int port) Opens and yields a new service for the given node, at the given network port.static PublicNodeServiceopen(PublicNode node, int port, int peerBroadcastInterval, int whisperedMessagesSize, Optional<URI> uri) Opens and yields a new service for the given node, at the given network port.
-
Method Details
-
open
public static PublicNodeService open(PublicNode node, int port) throws jakarta.websocket.DeploymentException, IOException Opens and yields a new service for the given node, at the given network port. The public URI of the machine is not provided to the service, therefore the service will try to guess its public IP and use it as its public URI. Uses 30 minutes as interval, in milliseconds, between successive broadcasts of the public IP of the service. Every such internal, the service will whisper its IP to its connected peers, in order to publish its willingness to become a peer. Uses 1000 as the size of the memory used to avoid whispering the same message again.- Parameters:
node- the nodeport- the port- Returns:
- the new service
- Throws:
jakarta.websocket.DeploymentException- if the service cannot be deployedIOException- if an I/O error occurs
-
open
public static PublicNodeService open(PublicNode node, int port, int peerBroadcastInterval, int whisperedMessagesSize, Optional<URI> uri) throws jakarta.websocket.DeploymentException, IOException Opens and yields a new service for the given node, at the given network port. It allows one to specify the public URL of the machine, which will be suggested as a peer for the connected remotes.- Parameters:
node- the nodeport- the portpeerBroadcastInterval- the time interval, in milliseconds, between successive broadcasts of the public IP of the service. Every such internal, the service will whisper its IP to its connected peers, in order to publish its willingness to become a peerwhisperedMessagesSize- the size of the memory used to avoid whispering the same message again; higher numbers reduce the circulation of spurious messagesuri- the URI that will be suggested as URL of the machine where the service is running; this might be empty, which means that the service will try to guess its public IP and use it as its public URI- Returns:
- the new service
- Throws:
jakarta.websocket.DeploymentException- if the service cannot be deployedIOException- if an I/O error occurs
-