Skip to main content
Loft provides real-time updates via a SignalR hub for live dashboard integration. Hub URL: wss://api.pidgeon.health/hubs/loft Authentication via JWT Bearer token or API Key.

Client → Server Methods

MethodParametersDescription
SubscribeToInterfaceinterfaceId: stringSubscribe to updates for a specific interface
UnsubscribeFromInterfaceinterfaceId: stringUnsubscribe from interface updates
SubscribeToAllSubscribe to all interface updates
UnsubscribeFromAllUnsubscribe from all updates

Server → Client Events

EventDescription
AlertReceivedNew alert triggered on a monitored interface
MetricUpdateInterface metrics changed (throughput, error rate)
InterfaceStatusChangedInterface status changed (healthy, degraded, down)

JavaScript Example

import { HubConnectionBuilder } from "@microsoft/signalr";

const connection = new HubConnectionBuilder()
  .withUrl("https://api.pidgeon.health/hubs/loft", {
    accessTokenFactory: () => "YOUR_JWT_TOKEN"
  })
  .withAutomaticReconnect()
  .build();

// Listen for alerts
connection.on("AlertReceived", (alert) => {
  console.log("Alert:", alert.severity, alert.message);
});

// Listen for metric updates
connection.on("MetricUpdate", (metric) => {
  console.log("Metrics:", metric.interfaceId, metric.messagesTotal);
});

// Listen for status changes
connection.on("InterfaceStatusChanged", (status) => {
  console.log("Status:", status.interfaceId, status.newStatus);
});

// Connect and subscribe
await connection.start();
await connection.invoke("SubscribeToInterface", "intf-001");

// Or subscribe to all interfaces
await connection.invoke("SubscribeToAll");

.NET Example

var connection = new HubConnectionBuilder()
    .WithUrl("https://api.pidgeon.health/hubs/loft", options =>
    {
        options.AccessTokenProvider = () => Task.FromResult("YOUR_JWT_TOKEN");
    })
    .WithAutomaticReconnect()
    .Build();

connection.On<AlertResponse>("AlertReceived", alert =>
{
    Console.WriteLine($"Alert: {alert.Severity} - {alert.Message}");
});

await connection.StartAsync();
await connection.InvokeAsync("SubscribeToAll");