aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-08-09 00:31:12 -0700
committerAdam Soltys <[email protected]>2023-08-09 00:32:18 -0700
commit923947519e74e28ab57f600100ea6d540d3fd561 (patch)
treed419516ffb7afd19d510b0ffe049277ce000db5c
parent46c887e4ff34c9ff6082687c9cbf1d158a26ecac (diff)
downloadcoinos-server-923947519e74e28ab57f600100ea6d540d3fd561.tar.gz
coinos-server-923947519e74e28ab57f600100ea6d540d3fd561.zip
mqtt
-rw-r--r--lib/payments.js6
-rw-r--r--package.json1
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/payments.js b/lib/payments.js
index 2d322a15..ee143a82 100644
--- a/lib/payments.js
+++ b/lib/payments.js
@@ -9,6 +9,7 @@ import { fail } from "$lib/utils";
import { callWebhook } from "$lib/webhooks";
import dollarsToWords from "dollars-to-words";
import got from "got";
+import mqtt from "mqtt";
export const types = {
internal: "internal",
@@ -186,6 +187,11 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
}
}
+ const client = mqtt.connect('mqtt://ln.coinos.io', config.mqtt);
+ client.on('connect', function () {
+ client.publish('payments', `${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}`);
+ });
+
return p;
};
diff --git a/package.json b/package.json
index a0cb82e9..98216258 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
"got": "^12.5.3",
"jsonwebtoken": "^9.0.0",
"lnurl": "^0.24.2",
+ "mqtt": "^5.0.2",
"nodemon": "^2.0.7",
"nostr": "^0.2.7",
"otplib": "^12.0.1",