summary refs log tree commit diff
path: root/lib/sd.js
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2024-12-02 21:08:39 +0200
committerWlodekM <[email protected]>2024-12-02 21:08:39 +0200
commit84ce4345128d4dd4e98e2104c8b0ca279fb273ab (patch)
tree8924e3ccf4237f5bd1b76a286867ee9903baf473 /lib/sd.js
parent2cb488b3bbe7cd061e1e15c8d63e3493a9f421f1 (diff)
uh
Diffstat (limited to 'lib/sd.js')
-rw-r--r--lib/sd.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sd.js b/lib/sd.js
index 46daf22..b2c7622 100644
--- a/lib/sd.js
+++ b/lib/sd.js
@@ -12,10 +12,12 @@ export default class SoktDeer {
     /** @type {any[]} */
     messages = [];
     constructor(wsUri = "wss://sokt.meltland.dev") {
+        console.log('uh 21')
         this.ws = new WebSocket(wsUri);
         this.ws.onmessage = (rdata) => {
             const data = JSON.parse(rdata.data.toString());
-            console.info("SD", "INCOMING", data)
+            console.info("SD", "INCOMING", data);
+            if (data.listener != null) return this.wsEvents.emit(`listener-${data.listener}`)
             if ('command' in data) return this.wsEvents.emit(data.command, data);
             if ('error' in data
                 && Object.keys(data).filter(k => !['error', 'code'].includes(k)).length > 0)
@@ -35,6 +37,7 @@ export default class SoktDeer {
     }
 
     login(username, password) {
+        console.log('cred login')
         return new Promise((resolve, reject) => {
             this.ws.send(JSON.stringify({
                 command: "login_pswd",
@@ -55,6 +58,7 @@ export default class SoktDeer {
 
     //TODO - implement this
     loginToken(token, username) {
+        console.log('token login')
         return new Promise((resolve, reject) => {
             this.ws.send(JSON.stringify({
                 command: "login_token",