Class PublicNodeServices

java.lang.Object
io.mokamint.node.service.PublicNodeServices

public final class PublicNodeServices extends Object
A provider of node services for the public API of a node.
  • 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 node
      port - the port
      Returns:
      the new service
      Throws:
      jakarta.websocket.DeploymentException - if the service cannot be deployed
      IOException - 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 node
      port - the port
      peerBroadcastInterval - 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 peer
      whisperedMessagesSize - the size of the memory used to avoid whispering the same message again; higher numbers reduce the circulation of spurious messages
      uri - 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 deployed
      IOException - if an I/O error occurs