/api/rke/sessions
GETLists all active RKE sessions with their details including domain, expiration time, and usage statistics.
Description
Returns a list of all active RKE sessions. Each session represents an encrypted communication channel with a Content Server, established through the DKE (Distributed Key Exchange) protocol.
Session Lifecycle
RKE sessions have a default lifetime of 1 hour (3600 seconds). After expiration:
- The session is automatically cleaned up
- Encrypt/decrypt operations using expired sessions will fail
- A new session must be created to continue communication
Parameters
This endpoint does not require any parameters.
Response
Returns a JSON object containing an array of active sessions.
Response Properties
command
string
Always "rke_sessions".
success
boolean
Always true for this endpoint.
total
integer
Total number of sessions in the store.
active
integer
Number of non-expired sessions.
sessions
array
Array of session objects.
sessions[].session_id
string
Unique 32-character hexadecimal session identifier. Use this ID for encrypt/decrypt operations.
sessions[].domain
string
Content Server domain this session is connected to.
sessions[].cs_id
string
Content Server ID (max 16 characters).
sessions[].created_at
string
ISO 8601 timestamp when the session was created.
sessions[].expires_at
string
ISO 8601 timestamp when the session will expire.
sessions[].encrypt_count
integer
Number of encryption operations performed with this session.
sessions[].decrypt_count
integer
Number of decryption operations performed with this session.
Example Response (With Sessions)
{
"command": "rke_sessions",
"success": true,
"total": 2,
"active": 2,
"sessions": [
{
"session_id": "a1b2c3d4e5f67890a1b2c3d4e5f67890",
"domain": "content.example.com",
"cs_id": "EXAMPLE_SERVER",
"created_at": "2025-11-30T10:00:00Z",
"expires_at": "2025-11-30T11:00:00Z",
"encrypt_count": 15,
"decrypt_count": 12
},
{
"session_id": "f0e1d2c3b4a5968778695a4b3c2d1e0f",
"domain": "media.cloudcoin.global",
"cs_id": "MEDIA_SERVER_1",
"created_at": "2025-11-30T10:30:00Z",
"expires_at": "2025-11-30T11:30:00Z",
"encrypt_count": 3,
"decrypt_count": 0
}
]
}
Example Response (No Sessions)
{
"command": "rke_sessions",
"success": true,
"total": 0,
"active": 0,
"sessions": []
}
Examples
JavaScript (fetch)
const API_HOST = 'http://localhost:8080';
async function listRkeSessions() {
try {
const response = await fetch(`${API_HOST}/api/rke/sessions`);
const result = await response.json();
if (result.success) {
console.log(`Found ${result.active} active sessions:`);
result.sessions.forEach(session => {
const expiresAt = new Date(session.expires_at);
const remainingMs = expiresAt - new Date();
const remainingMins = Math.floor(remainingMs / 60000);
console.log(`\nSession: ${session.session_id.substring(0, 8)}...`);
console.log(` Domain: ${session.domain}`);
console.log(` CS ID: ${session.cs_id}`);
console.log(` Expires in: ${remainingMins} minutes`);
console.log(` Usage: ${session.encrypt_count} encrypts, ${session.decrypt_count} decrypts`);
});
}
return result;
} catch (error) {
console.error('Error listing sessions:', error);
}
}
listRkeSessions();
cURL
# List all RKE sessions
curl "http://localhost:8080/api/rke/sessions"
# Pretty print with jq
curl "http://localhost:8080/api/rke/sessions" | jq
# Extract just session IDs
curl "http://localhost:8080/api/rke/sessions" | jq -r '.sessions[].session_id'
Go
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
const ApiHost = "http://localhost:8080"
type Session struct {
SessionID string `json:"session_id"`
Domain string `json:"domain"`
CsID string `json:"cs_id"`
CreatedAt string `json:"created_at"`
ExpiresAt string `json:"expires_at"`
EncryptCount int `json:"encrypt_count"`
DecryptCount int `json:"decrypt_count"`
}
type SessionsResponse struct {
Command string `json:"command"`
Success bool `json:"success"`
Total int `json:"total"`
Active int `json:"active"`
Sessions []Session `json:"sessions"`
}
func ListRkeSessions() (*SessionsResponse, error) {
resp, err := http.Get(fmt.Sprintf("%s/api/rke/sessions", ApiHost))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
var result SessionsResponse
json.Unmarshal(body, &result)
return &result, nil
}
func main() {
sessions, _ := ListRkeSessions()
fmt.Printf("Active Sessions: %d\n", sessions.Active)
for _, s := range sessions.Sessions {
fmt.Printf(" %s -> %s\n", s.SessionID[:8], s.Domain)
}
}