Sessions API health check
curl --request GET \
--url http://localhost:3000/api/messaging/sessions/healthimport requests
url = "http://localhost:3000/api/messaging/sessions/health"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('http://localhost:3000/api/messaging/sessions/health', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/messaging/sessions/health",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/api/messaging/sessions/health"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:3000/api/messaging/sessions/health")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/messaging/sessions/health")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "healthy",
"activeSessions": 123,
"timestamp": "2023-11-07T05:31:56Z",
"expiringSoon": 123,
"invalidSessions": 123,
"uptime": 123
}Session Lifecycle
Sessions Health Check
Check the health status of the sessions service and get active session statistics
GET
/
api
/
messaging
/
sessions
/
health
Sessions API health check
curl --request GET \
--url http://localhost:3000/api/messaging/sessions/healthimport requests
url = "http://localhost:3000/api/messaging/sessions/health"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('http://localhost:3000/api/messaging/sessions/health', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/messaging/sessions/health",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/api/messaging/sessions/health"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:3000/api/messaging/sessions/health")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/messaging/sessions/health")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "healthy",
"activeSessions": 123,
"timestamp": "2023-11-07T05:31:56Z",
"expiringSoon": 123,
"invalidSessions": 123,
"uptime": 123
}This endpoint provides real-time health metrics for the Sessions API service, including active session counts and service uptime.
Response
string
Service health status: “healthy”, “degraded”, or “unhealthy”
number
Number of currently active (non-expired) sessions
string
ISO timestamp of the health check
number
Number of sessions that are within their warning threshold
number
Number of corrupted or invalid sessions detected (only shown if > 0)
number
Service uptime in seconds
Example Response
{
"status": "healthy",
"activeSessions": 42,
"timestamp": "2024-01-15T10:30:45.123Z",
"expiringSoon": 3,
"uptime": 3600.5
}
Health Status Meanings
- healthy: Service is operating normally
- degraded: Service is operational but experiencing issues (e.g., invalid sessions detected)
- unhealthy: Service is not operational or experiencing critical issues
Usage
This endpoint is useful for:- Monitoring service availability
- Tracking session volume
- Detecting memory leaks (via active session count)
- Setting up health check probes in orchestration systems
- Dashboard metrics and alerting
Response
200 - application/json
Sessions API is healthy
Available options:
healthy, degraded, unhealthy Number of currently active sessions
Number of sessions near expiration
Number of invalid sessions detected (only shown if > 0)
Service uptime in seconds
Was this page helpful?

