# ディスプレイ0に通知を送信
curl -X POST ".../notify"
-d '["display":"0","summary":"Build Complete","urgency":"normal"]'
# レスポンス
["message":"Notification sent successfully","success":true]
3ステップ。各1回のHTTPコール。
すべての通知は同じライフサイクルに従います:トリガー、履歴のフェッチまたはストリーム、終了。
トリガー
POST /notifyがターゲットX11ディスプレイにnotify-sendコールを送信。ディスプレイ、サマリー、緊急度などを指定。
# Fire a notification
POST /notify
{"display":"0",
"summary":"Build Complete",
"urgency":"normal"}
'{'"success":true'}'
フェッチまたはストリーム
GET /[display]は通知履歴をlimit、since、username、severityフィルターでオプション付きで取得。
# Poll history
curl ".../0?limit=50"
# Or open a WebSocket
new WebSocket(
"wss://.../stream?displays=0"
)
却下
POST /dismissが通知IDを却下済みとしてマーク — 以降のGETから除外されます。
# Dismiss by ID
POST /dismiss
{"displayId":"0",
"notificationIds":[10,11,12]}
# Clear dismissed state
DELETE /dismiss?displayId=0
low. normal. critical.
3つの緊急度レベルはnotify-sendの動作に直接マップ。適切なものを選ぶと通知は正しく動作します。
素早く消えます。バックグラウンドタスクや情報メッセージにはexpire_time: 3000を設定。
"urgency": "low",
"expire_time": 3000
標準。緊急度省略時のデフォルト。通知デーモンが設定された時間表示します。
"urgency": "normal"
// default — omit to use this
手動で却下するまで表示。システム障害やビルドエラーにはexpire_time: 0を設定。
"urgency": "critical",
"expire_time": 0
履歴をフェッチまたはライブストリーム。
2つの読み取りチャンネルが異なるニーズに対応:REST監査ログと一時的クエリ用、WebSocketリアルタイムサブスクリプション用。
ディスプレイの通知履歴を取得。limit、sinceタイムスタンプ、username、severityでフィルター。
# ディスプレイ0の最後の50件を取得
curl ".../0?limit=50"
# 時間でフィルター
curl ".../0?since=1749025000000"
id、summary、urgency、timestamp、icon_urlを含む通知オブジェクトのJSON配列。
displays=0,:1,2またはdisplays=allで1つ以上のディスプレイにサブスクライブ。新しい通知ごとにプッシュメッセージを受信。
# WebSocketを開く
const ws = new WebSocket(
"wss://.../stream?displays=0"
)
# メッセージ受信時
ws.onmessage = (e) => {
const msg = JSON.parse(e.data)
// msg.type === 'notification'
}
新しい通知ごとに[ type: "notification", data: [ id, summary, urgency, timestamp ] ]がプッシュされます。
ビルドパイプラインからMLジョブまで。
長時間実行プロセスが完了または失敗をシグナルする必要がある場合、1回のHTTP POSTで十分です。
CI/CDアラート
長時間のビルドが完了。HTTP POSTがコンテナディスプレイに通知をトリガー — ブラウザのどこからでも確認可能。
システムモニタリング
サーバーアラートがコンテナのX11ディスプレイのデスクトップ通知にルーティングされ、ブラウザウィンドウで表示。
長時間タスク
データエクスポート、動画レンダリング、MLモデルトレーニング、バックアップ完了 — 完了時に通知。
自動化ワークフロー
Cronジョブ、スケジュールタスク、自動化スクリプトが完了時にコンテナディスプレイに通知。
8エンドポイント。1つの通知サーバー。
トリガー、取得、ストリーム、却下デスクトップ通知 — アイコンとヘルスモニタリング — すべてプレーンHTTPで。
トリガー
{count, plural, =1 {# endpoint} other {# endpoints}'}POST .../api/v1/notifications/notify → {"success":true}
取得 & ストリーム
{count, plural, =1 {# endpoint} other {# endpoints}'}GET .../api/v1/notifications/{display}?limit=50&since=...
アイコン
{count, plural, =1 {# endpoint} other {# endpoints}'}GET .../api/v1/notifications/icons/{iconId} → image/png
ヘルス & メトリクス
{count, plural, =1 {# endpoint} other {# endpoints}'}GET .../api/v1/notifications/health → {"status":"UP"}