aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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 /lib
parent46c887e4ff34c9ff6082687c9cbf1d158a26ecac (diff)
downloadcoinos-server-923947519e74e28ab57f600100ea6d540d3fd561.tar.gz
coinos-server-923947519e74e28ab57f600100ea6d540d3fd561.zip
mqtt
Diffstat (limited to 'lib')
-rw-r--r--lib/payments.js6
1 files changed, 6 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;
};