Comments (4)
This will also reduce the load on the backend if users don't have to poll all the time. Most real node backends support some form of notification on payment finalization. For the ones that don't support that there could be a central thread polling all open payments and sending notifications instead of every request causing a separate poll.
from lnbits.
WebSockets need to happen at some point, this is as good an excuse as any.
Linking LNbits and BTCPay server is an exciting concept
from lnbits.
WebSockets need to happen at some point, this is as good an excuse as any.
Linking LNbits and BTCPay server is an exciting concept
Yes, I could integrate LNBits as if it was another lightning node in our lightning abstraction. Someone offering a BTCPay server to multiple merchants could then host LNBits alongside and use that as a way for them to accept lightning via their node!
Will need the websocket support and multiarch docker images though
from lnbits.
Hey, just a heads up: LNbits now has an (still undocumented while we make sure it works) SSE endpoint that you can listen to to get an event every time an invoice payment is received (it listens for notifications in the background from each of the funding sources -- except lntxbot), matches the incoming payments to each LNbits wallet and dispatches the event there.
curl https://lnbits.example/api/v1/payments/sse -H 'x-api-key: yourkey'
should work. It will give you something like this:
curl 'http://localhost:5000/api/v1/payments/sse' -H 'x-api-key: 4b0518a9a640af02b5165fd9879a756c'
event: keepalive
event: payment
data: {"checking_id": "UeEG32TSDuKUzsxwUJupgX0Nlf8Ix9aElrDPGcmQzUU=", "pending": 0, "amount": 600000, "fee": 0, "memo": "an invoice", "time": 1602288389, "bolt11": "lnbcrt60n1p0cp7c9pp528ssdhmy6g8w99xwe3c9pxafs97sm90lprradpykkr83njvse4zsdqzyccqzpgxqzjcsp52439y3p0sg8mqvgrr5tfx56prq59nrmmq52cqjv09wr9c3kw35yq9qy9qsqfjv5egvze5dtl7n0dg24f533xdvvxm2w0u9l5pl3j79fvfknc05q02lxtggtd3rqsrgu6wyetyt0tgdhv78d38s4qljmvar00hux2dspcqq0k7", "preimage": "0000000000000000000000000000000000000000000000000000000000000000", "payment_hash": "51e106df64d20ee294cecc70509ba9817d0d95ff08c7d68496b0cf19c990cd45", "extra": {}, "wallet_id": "8fbefbdba16c4dd19afa641ebd51fd5e"}
event: keepalive
event: keepalive
I chose an SSE stream because it seems to be lighter and simpler to implement on every side, but WebSockets or Webhooks are also possible to do.
The code is here if anyone is curious:
lnbits/lnbits/core/views/api.py
Lines 134 to 185 in 2894944
from lnbits.
Related Issues (20)
- Support sending to BIP-353 (DNS Payment Instructions) HOT 5
- Replace python-jose with pyjwt or joserfc HOT 1
- Replace secp256k1 with coincurve
- [BUG] (!) The Toggle Admin switch for user is enabled again and again after restarting LNBits. HOT 2
- [BUG] Strange errors: raise WouldBlock / anyio.WouldBlock / anyio.EndOfStream HOT 4
- [BUG] Constant request of exchange rate pairs where they are not in the API
- [BUG] VoidWallet selected if started at the same time than LND HOT 4
- [Feature request] Charge diffrent fee levels
- [Feature request] add local extensions tab into extension manager
- [BUG] Incorrect amount conversion for unit `msat` POST `/api/v1/payments` HOT 2
- Dead legend.lnbits.com server, are funds lost on the service you provided? HOT 1
- [BUG] Encrypted Macaroon and Admin Macaroon problem for LndWallet HOT 4
- [BUG] Developer documentation is insufficient for building the project HOT 1
- [Feature request] create a proper TaskManager class
- [BUG] Deactivating an extension for users disables it for Super User HOT 1
- [BUG] Created users with User Manager are unable to login with username/email and password
- [BUG] Admin topup doesn't work with the Blink funding source HOT 1
- [BUG] Certificate hostname mismatch when connecting to LND node (REST) HOT 2
- [BUG] Unused packages "bitstring" and "bitarray"? HOT 1
- [Feature request] install local extensions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lnbits.