LogoLogo
  • About
  • Installation
  • Update & migration
  • Configuration
    • Hostname
    • TLS / HTTPS
    • Database
    • Logging
    • API Security
    • Storage
      • Disk
      • In-memory
      • S3
    • RTMP
    • SRT
    • FFmpeg
    • Sessions
    • Metrics
    • Router
    • Debug
  • API Swagger-Documentation
  • API Clients
  • Web-Interface
  • Guides
    • Beginner
    • RTMP
    • SRT
    • Filesystems
  • General
    • Prometheus metrics
  • API
    • Login
    • Config
    • Log
    • Filesystem
      • Disk
      • In-memory
      • S3
    • Metrics
    • Sessions
    • Profiling
    • Ping
  • API / FFmpeg
    • Process
      • Command
      • Metadata
      • State
      • Probe
      • Report
    • Skills
    • Widget (Website)
  • API / RTMP
    • RTMP
  • API / SRT
    • SRT
  • Development
    • Architecture
    • Coding
    • Custom Docker images
    • Benchmark
    • Support
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. API

Sessions

PreviousMetricsNextProfiling

Last updated 2 years ago

Was this helpful?

Sessions are tracking user actions regarding pushing and pulling video data to and from the core. There are different kind of sessions that are captured:

  • HLS Sessions (hls collector) How many users are watching an HLS stream

  • HLS Ingress Sessions (hlsingress collector) How many users are publishing a stream via the in-memory filesystem

  • HTTP Sessions (http collector) How many users are reading or writing http data via the build-in HTTP server

  • RTMP Sessions (rtmp collector) How many users are publishing or watching a stream via the built-in RTMP server

  • SRT Sessions (srt collector) How many users are publishing or watching a stream via the built-in SRT server

  • FFmpeg Sessions (ffmpeg collector) How many streams is FFmpeg using as an input or as an output

The data for each session include the current ingress and egress bandwidth, the total amount of data, an identifier for the session itself, the local end of the stream and the remote end of the stream.

The following API endpoints allow to extract information about the currently active sessions or additionally a summary of the already finished sessions. Each endpoint requires a comma-separated list of collectors as query parameter collectors.

Active sessions with summary

Example:

curl http://127.0.0.1:8080/api/v3/session?collectors=hls,rtmp \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X GET
from core_client import Client

client = Client(
    base_url="http://127.0.0.1:8080"
)
client.login()

core_sessions = client.v3_session_get(
    collectors="hls,rtmp"
)
print(core_sessions)
import (
    "fmt"
    "github.com/datarhei/core-client-go/v16"
)

client, _ := coreclient.New(coreclient.Config{
    Address: "https://127.0.0.1:8080",
})

sessions, err := client.Sessions([]string{"hls", "rtmp"})
fmt.Printf("%+v\n", sessions)

Description:

Active sessions

Example:

curl http://127.0.0.1:8080/api/v3/session/active?collectors=hls,rtmp \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X GET
from core_client import Client

client = Client(
    base_url="http://127.0.0.1:8080"
)
client.login()

core_active_sessions = client.v3_session_get_active(
    collectors="hls,rtmp"
)
print(core_active_sessions)
import (
    "fmt"
    "github.com/datarhei/core-client-go/v16"
)

client, _ := coreclient.New(coreclient.Config{
    Address: "https://127.0.0.1:8080",
})

sessions, err := client.SessionsActive([]string{"hls", "rtmp"})
fmt.Printf("%+v\n", sessions)

Description:

Get a summary of all active and past sessions

get

Get a summary of all active and past sessions of the given collector.

Authorizations
Query parameters
collectorsstringOptional

Comma separated list of collectors

Responses
200
Sessions summary
application/json
get
GET /v3/session HTTP/1.1
Host: api
Authorization: YOUR_API_KEY
Accept: */*
200

Sessions summary

{
  "ANY_ADDITIONAL_PROPERTY": {
    "active": {
      "bandwidth_rx_mbit": 1,
      "bandwidth_tx_mbit": 1,
      "list": [
        {
          "bandwidth_rx_kbit": 1,
          "bandwidth_tx_kbit": 1,
          "bytes_rx": 1,
          "bytes_tx": 1,
          "created_at": 1,
          "extra": "text",
          "id": "text",
          "local": "text",
          "reference": "text",
          "remote": "text"
        }
      ],
      "max_bandwidth_rx_mbit": 1,
      "max_bandwidth_tx_mbit": 1,
      "max_sessions": 1,
      "sessions": 1
    },
    "summary": {
      "local": {
        "ANY_ADDITIONAL_PROPERTY": {
          "sessions": 1,
          "traffic_rx_mb": 1,
          "traffic_tx_mb": 1
        }
      },
      "reference": {
        "ANY_ADDITIONAL_PROPERTY": {
          "sessions": 1,
          "traffic_rx_mb": 1,
          "traffic_tx_mb": 1
        }
      },
      "remote": {
        "ANY_ADDITIONAL_PROPERTY": {
          "local": {
            "ANY_ADDITIONAL_PROPERTY": {
              "sessions": 1,
              "traffic_rx_mb": 1,
              "traffic_tx_mb": 1
            }
          },
          "sessions": 1,
          "traffic_rx_mb": 1,
          "traffic_tx_mb": 1
        }
      },
      "sessions": 1,
      "traffic_rx_mb": 1,
      "traffic_tx_mb": 1
    }
  }
}

Get a minimal summary of all active sessions

get

Get a minimal summary of all active sessions (i.e. number of sessions, bandwidth).

Authorizations
Query parameters
collectorsstringOptional

Comma separated list of collectors

Responses
200
Active sessions listing
application/json
get
GET /v3/session/active HTTP/1.1
Host: api
Authorization: YOUR_API_KEY
Accept: */*
200

Active sessions listing

{
  "ANY_ADDITIONAL_PROPERTY": [
    {
      "bandwidth_rx_kbit": 1,
      "bandwidth_tx_kbit": 1,
      "bytes_rx": 1,
      "bytes_tx": 1,
      "created_at": 1,
      "extra": "text",
      "id": "text",
      "local": "text",
      "reference": "text",
      "remote": "text"
    }
  ]
}
  • Active sessions with summary
  • GETGet a summary of all active and past sessions
  • Active sessions
  • GETGet a minimal summary of all active sessions