Class NetSubmitter

java.lang.Object
io.github.projectunified.faststats.net.NetSubmitter
All Implemented Interfaces:
Submitter

public class NetSubmitter extends Object implements Submitter
Implementation of Submitter that uses HttpURLConnection to submit GZIP-compressed telemetry payloads.
  • Constructor Details

    • NetSubmitter

      public NetSubmitter(String token)
      Constructs a new NetSubmitter with the default metrics URL (https://metrics.faststats.dev/v1/collect) and default user agent.
      Parameters:
      token - the authorization token (bearer)
    • NetSubmitter

      public NetSubmitter(URL url, String token, String userAgent)
      Constructs a new NetSubmitter.
      Parameters:
      url - the target metrics URL
      token - the authorization token (bearer)
      userAgent - the user agent header value
  • Method Details

    • execute

      public void execute(String json) throws Exception
      Description copied from interface: Submitter
      Executes the HTTP request carrying the serialized JSON payload.
      Specified by:
      execute in interface Submitter
      Parameters:
      json - the JSON payload to transmit
      Throws:
      Exception - if transmission fails