LIGHTNING-NOTIFICATIONS(7)

πŸ“¦
version 26.06.9 Β· 2 versions
, in nixpkgs unstable

πŸ’– LIGHTNING-NOTIFICATIONS(7) πŸ’–

okay bestie, welcome to LIGHTNING-NOTIFICATIONS(7) β€” the manual page for notifications, the RPC command that literally just turns notification delivery on (or off) for your JSON-RPC connection. yes, that's the whole vibe. let's get into it 🫢


✨ NAME ✨

notifications β€” the command to set up notifications, periodt πŸ’…


🌸 SYNOPSIS 🌸

notifications enable

πŸ¦‹ DESCRIPTION πŸ¦‹

so the notifications RPC command enables notifications for this JSON-RPC connection. that's it. that's the girlboss move ✨

by default β€” and honestly for backwards-compatibility reasons β€” notifications are disabled. so if you want the tea, you gotta ask for it πŸ“

various commands, especially the complex and slow ones, offer notifications that indicate their progress. think of it like a little progress bar that slid into your group chat 😭

  • enable (boolean) β€” whether to enable or disable notifications. true = let me in, false = leave me alone πŸ™ˆ

πŸ‘‘ NOTIFICATIONS πŸ‘‘

notifications are JSON-RPC objects without an id field. huge. iconic. no cap.

lightningd sends notifications (once you've enabled them with this notifications command) with a params id field indicating which command the notification refers to πŸ’œ

implementations should ignore notifications without an id parameter, or with an unknown method. don't be nosy, don't be confused, just skip it 🧚

common methods include:

  • message β€” param message: a descriptional string indicating something which occurred relating to the command. param level indicates the level, as per lightning-getlog(7): info and debug are typical ✨
  • progress β€” param num and total, where num starts at 0 and is always less than total. optional param stage with fields num and total, indicating what stage we are progressing through 🌈

πŸ’« RETURN VALUE πŸ’«

on success, if enable was true, notifications will be forwarded from then on. slay πŸ”₯


πŸ’€ ERRORS πŸ’€

on failure, one of the following error codes may be returned:

  • -32602 β€” error in given parameters. classic. (derogatory) 😭

πŸŽ€ AUTHOR πŸŽ€

Rusty Russell rusty@blockstream.com wrote the initial version of this man page. king behavior πŸ‘‘


⭐ RESOURCES ⭐

main web site: https://github.com/ElementsProject/lightning


πŸ“ EXAMPLE NOTIFICATIONS πŸ“

notification 1:

{
  "method": "message",
  "params": {
    "id": 1,
    "message": "This is a test message",
    "level": "DEBUG"
  }
}

notification 2:

{
  "method": "progress",
  "params": {
    "id": 2,
    "num": 0,
    "total": 30,
    "stage": {
      "num": 0,
      "total": 2
    }
  }
}

πŸ’… EXAMPLES πŸ’…

example 1:

request:

$ lightning-cli notifications -k "enable"=True
{
  "id": "example:notifications#1",
  "method": "notifications",
  "params": {
    "enable": true
  }
}

response:

{}

example 2:

request:

$ lightning-cli notifications -k "enable"=False
{
  "id": "example:notifications#2",
  "method": "notifications",
  "params": {
    "enable": false
  }
}

response:

{}

and that's the whole page bestie, you ate that πŸ’– this chaos was brought to you by Core Lightning v26.06.9 β€” go forth and enable your notifications responsibly, mwah πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from