Skip to content

Conversation

@dbehnke
Copy link
Contributor

@dbehnke dbehnke commented Dec 24, 2025

This PR integrates a non-blocking NNG Publisher into the urfd core for real-time event broadcasting (connect, disconnect, and hearing events).

Features:

  • Configurable NNG socket address via the [Dashboard] section in the .ini file.
  • Thread-safe JSON serialization using nlohmann/json.
  • Minimal overhead using NNG's non-blocking PUB pattern.

@dbehnke
Copy link
Contributor Author

dbehnke commented Dec 24, 2025

Implementation Overview: NNG JSON Publisher

This implementation adds a real-time event broadcasting system to the urfd core using the NNG (Nanomsg Next Gen) library.

Why NNG?

Current telemetry in urfd (JSON/XML files) is periodic and "pull-based," which introduces latency for live dashboards. NNG’s PUB/SUB pattern allows the reflector to "push" events instantly to any number of subscribers (dashboard middleware, logging services, etc.) with minimal overhead.

Technical Highlights

  • Asynchronous & Non-blocking: Broadcasts use the NNG_FLAG_NONBLOCK flag. This ensures that the core reflector logic remains completely decoupled from the telemetry consumers; if a consumer is slow or disconnected, the reflector is never blocked.
  • Centralized Event Hooks: By hooking into the CClients and CUsers containers, we capture connection and "Hearing" (Last Heard) events across all supported protocols (M17, YSF, DMR, D-Star, etc.) simultaneously.
  • Configurable Binding: The publisher address is configurable in the .ini file, allowing it to bind to TCP or IPC (Unix Domain Sockets) based on the deployment environment.
  • Standardized JSON: Leverages the existing nlohmann/json dependency to provide a consistent, easily consumable data format for modern web-based dashboards.

This addition provides the foundation for low-latency, real-time monitoring of reflector activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant