MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. rico24
    3. Topics
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    R
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 8
    • Groups 1

    Topics

    • R

      Making my first module: issue with notifications

      Watching Ignoring Scheduled Pinned Locked Moved Unsolved Troubleshooting notifications module magicmirror
      8
      0 Votes
      8 Posts
      1k Views
      S
      @rico24 and here is an updated node_helper, that rejects connecting clients if they don’t send the right kind of identifier (ends with a digit) var NodeHelper = require('node_helper'); var request = require('request'); module.exports = NodeHelper.create({ initial_counter:10000, start: function() { this.countDown = {} }, isDigit: function(x){ return (x>='0' && x< ='9') // watch out for spaces after < , forum hides it all }, socketNotificationReceived: function(notification, payload) { console.log("Payload: =" + JSON.stringify(payload)); switch(notification){ case "DO_YOUR_JOB": if(this.isDigit(payload.identifier.slice(-1))){ if(!this.countDown.hasOwnProperty(payload.identifier+this.ourpage)){ this.countDown[payload.identifier]=this.initial_counter; } let return_payload={identifier: payload.identifier, value:(this.countDown[payload.identifier] - payload.value)} this.sendSocketNotification("I_DID",return_payload ) console.log("Payload 2: = " + JSON.stringify(return_payload)); } else this.sendSocketNotification("I_DID_REJECTED_INVALID_IDENTIFIER",payload ) break } }, });
    • R

      Publishing MM module

      Watching Ignoring Scheduled Pinned Locked Moved Solved Development
      3
      0 Votes
      3 Posts
      790 Views
      R
      Thanks! I will update when the module is published. First I need to solve some issues :)
    • 1 / 1