From 47ca57b9da169a31309a369a403bb7a5197b43ac Mon Sep 17 00:00:00 2001 From: CDeenen Date: Wed, 18 Nov 2020 02:57:47 +0100 Subject: [PATCH] v0.8.6 --- MaterialDeck.js | 28 +++++++++++++++++++++------- changelog.md | 9 +++++++++ lang/en.json | 4 ++-- module.json | 2 +- src/streamDeck.js | 18 ++++++++++++------ 5 files changed, 45 insertions(+), 16 deletions(-) diff --git a/MaterialDeck.js b/MaterialDeck.js index 5a4c6b6..50f151e 100644 --- a/MaterialDeck.js +++ b/MaterialDeck.js @@ -30,7 +30,7 @@ var enableModule; //Websocket variables let ip = "localhost"; //Ip address of the websocket server -let port = "3003"; //Port of the websocket server +let port = "3001"; //Port of the websocket server var ws; //Websocket variable let wsOpen = false; //Bool for checking if websocket has ever been opened => changes the warning message if there's no connection let wsInterval; //Interval timer to detect disconnections @@ -41,11 +41,20 @@ let WSconnected = false; * * @param {*} msg Message received */ -async function analyzeWSmessage(msg,passthrough = false){ +async function analyzeWSmessage(msg){ if (enableModule == false) return; const data = JSON.parse(msg); + //console.log("Received",data); + + if (data.type == "connected" && data.data == "SD"){ + console.log("streamdeck connected to server"); + } + + + + if (data == undefined || data.payload == undefined) return; - //console.log("Received",data); + const action = data.action; const event = data.event; const context = data.context; @@ -114,11 +123,10 @@ async function analyzeWSmessage(msg,passthrough = false){ */ function startWebsocket() { //ip = localhost; - ws = new WebSocket('ws://'+ip+':'+port+'/1'); + ws = new WebSocket('ws://'+ip+':'+port); ws.onmessage = function(msg){ //console.log(msg); - analyzeWSmessage(msg.data); clearInterval(wsInterval); wsInterval = setInterval(resetWS, 5000); @@ -128,10 +136,16 @@ function startWebsocket() { WSconnected = true; ui.notifications.info("Material Deck "+game.i18n.localize("MaterialDeck.Notifications.Connected") +": "+ip+':'+port); wsOpen = true; - let msg = { - type: "Foundry" + const msg = { + target: "server", + module: "MD" } ws.send(JSON.stringify(msg)); + const msg2 = { + target: "SD", + type: "init" + } + ws.send(JSON.stringify(msg2)); clearInterval(wsInterval); wsInterval = setInterval(resetWS, 5000); } diff --git a/changelog.md b/changelog.md index d6379f7..f152a9c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,13 @@ # Changelog Material Deck Module +### v0.8.6 - 18-11-2020 + + +Compatible server app and SD plugin:
+Material Server v1.0.0: https://github.com/CDeenen/MaterialServer/releases
+SD plugin v0.7.3: https://github.com/CDeenen/MaterialDeck_SD/releases
+ ### v0.8.5 - 17-11-2020