KRYONOS
Math, Security & Services

Inter-App IPC & Notifications

Inter-process communication bus, intent dispatching, and non-blocking floating system toast notifications in KryonOS.

Inter-App IPC & System Notifications

KryonOS enables background services, system daemons, and active foreground UI applications to exchange data using a lightweight Inter-Process Communication (IPC) message broker.

Kernel event bus drivers are hosted in the KryonOS GitHub Repository.


1. Floating System Notifications

System notifications render non-blocking animated toast alerts at the top of the display glass without interrupting the running application's logic or frame loop.

System.notify(title, message, durationMs, icon, tone)

Triggers a floating banner overlay.

  • Parameters:
    • title (String): Notification header (e.g. "Battery Low").
    • message (String): Secondary description (e.g. "15% remaining").
    • durationMs (Integer, optional, default 3000): Display time in milliseconds.
    • icon (String, optional): Built-in icon name (e.g. "battery", "wifi", "mail", "warning").
    • tone (Boolean, optional, default false): Plays an audio chime on the onboard buzzer.
  • Returns: Boolean
// Display a system toast notification with sound
System.notify("Mesh Network", "Node 0x4A joined the cluster", 4000, "wifi", true);

2. Inter-Process Communication (IPC)

The System.ipc (or IPC) engine provides point-to-point and broadcast messaging between running background services and foreground JavaScript applications.

System.ipc.on(eventName, callback)

Registers an event listener callback for incoming IPC messages.

  • Parameters:
    • eventName (String): Unique event or topic name.
    • callback (Function): Handler function function(payload, senderId).
  • Returns: Boolean

System.ipc.send(targetAppId, messageName, payload)

Sends a direct message to a specific running background daemon or application.

  • Parameters:
    • targetAppId (String): Target application ID (e.g. "com.kryonos.meshdaemon").
    • messageName (String): Message identifier.
    • payload (Object or String): Data payload.
  • Returns: Boolean

System.ipc.broadcast(eventName, payload)

Broadcasts a message to all active listeners across the entire OS.

  • Parameters:
    • eventName (String): Event topic name.
    • payload (Object or String)
  • Returns: Integer (Number of active listeners reached).

Code Example: Background Sensor Daemon & UI App

// Background Service (daemon.js)
function pollSensors() {
  var gasLevel = System.gpio.analogRead(34);
  if (gasLevel > 2500) {
    // Alert foreground apps
    System.ipc.broadcast("sensor:gas_alert", {
      level: gasLevel,
      timestamp: System.millis()
    });
    System.notify("Gas Sensor Warning", "Elevated level detected: " + gasLevel, 5000, "warning", true);
  }
}

// Foreground App (app.js)
System.ipc.on("sensor:gas_alert", function(data) {
  System.print("Received gas alert event with level: " + data.level);
  System.fillRect(0, 0, 240, 40, 0xF800); // Red alert banner
});

On this page