SysMonitoring
  • Introduction
  • Installation
  • Configuration
  • Troubleshooting
  • Functions
    • startServer()
    • stopServer()
    • getCpuLoad()
    • getMemoryUsage()
    • getPing()
  • API
    • /cpu
    • /memory
    • /ping
  • Terminal Commands
    • echo
    • time
    • help
    • stats
Powered by GitBook
On this page
  • Overview
  • Endpoint
  • Example
  • Response
  • Description
  1. API

/ping

/api/ping

Overview

The /api/ping endpoint returns the current network latency (ping) in the form of a JSON response.

Endpoint

GET /api/ping

Example

fetch('/api/ping')
  .then(response => response.json())
  .then(data => {
    console.log(`Ping: ${data.ping}ms`);
  });

Response

The response will return a JSON object containing the ping value:

{
  "ping": 25
}

Description

  • /api/ping provides the current network latency (ping) in milliseconds (ms).

  • It uses the getPing() function internally to fetch the data.

  • The result is returned as an integer representing the network latency in milliseconds.

Previous/memoryNextecho

Last updated 5 months ago