Read the statement by Michael Teeuw here.
Multiple URL Querys to fill JSON
-
@htilburgs you cant have two socketNotificationReceived() functions
only 1, but it gets both notifications
if notification=== "type1" call this function else if notification=== "type2" call that function
-
@sdetweil I’ve changed it into this, but still only result from the WaterMeter and not the P1 meter
socketNotificationReceived: function(notification, payload) { if (notification === "MHWP1_RESULT") { // this notification doesn't come back on error.. this.processMHW_P1(payload); this.updateDom(this.config.initialLoadDelay); } else if (notification === "MHWWM_RESULT") { // this notification doesn't come back on error.. this.processMHW_WM(payload); this.updateDom(this.config.initialLoadDelay); } },
-
@htilburgs I meant in the node_helper… you have 2 there as well
-
@sdetweil Wow, it works!
Just checking, it has to be done in node_helper and the MMM-Module? -
@htilburgs the sendSocketNotification(xyz,foo) ------->socketNotificationReceived(notification, payload)
in both directions…only one received on each side… if there are multiple, then the last one seen is used.
-
@sdetweil Thnx, you helped me a lot!!
-
This is not a direct answer to the question, but just for your reference.
Thefetch
API can be executed directly in the browser, not just in a Node.js environment. You can call thefetch
API directly inMMM-MyModule.js
without needingnode_helper.js
.Additionally, since the
fetch
API works asynchronously, you can manage the responses of two fetch calls as follows:- If you need to use the response that arrives first, use
Promise.race()
orPromise.any()
. - If you need to wait for both responses to arrive before proceeding, use
Promise.all()
.
Using these methods can help you manage data synchronization more efficiently.
- If you need to use the response that arrives first, use
-
@MMRIZE quite true, since fetch is now part of electron.
-
@MMRIZE Thanks for your reaction.
-