MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Get user input

    Scheduled Pinned Locked Moved Development
    3 Posts 2 Posters 2.3k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V Offline
      veryaner
      last edited by paviro

      Hi, I’m still pretty new in this node.js topic, but I’m really interesting in adding some modules.
      I’m struggling to get user input base on a button in the front-end (not physical button) but I cannot find the solution.
      I tried with:

      // create the server
      	listen: function() {
      		this.expressApp.get('/Button1', function (req, res) {
      			sendSocketNotification('BUTTON1', 'Hello world');
      			//res.send('Stop signal sent!');
      		});
      	},
      

      But I got a:
      ReferenceError: sendSocketNotification is not defined
      or with this.sendSocketNotification I got:
      TypeError: this.sendSocketNotification is not a function

      Is there any way to get the user input?

      Thanks!


      Note from admin: Please use Markdown on code snippets for easier reading!

      strawberry 3.141S 1 Reply Last reply Reply Quote 0
      • strawberry 3.141S Offline
        strawberry 3.141 Project Sponsor Module Developer @veryaner
        last edited by

        @veryaner if you want you can have a look in my Module, i did a similar approach, this might get you started.

        [card:fewieden/MMM-syslog]

        Please create a github issue if you need help, so I can keep track

        1 Reply Last reply Reply Quote 2
        • V Offline
          veryaner
          last edited by

          Great it worked!!! My mistake was that I was creating the app after a notification and not at the start of my module!
          Thanks a lot!

          1 Reply Last reply Reply Quote 1
          • 1 / 1
          • First post
            Last post
          Enjoying MagicMirror? Please consider a donation!
          MagicMirror created by Michael Teeuw.
          Forum managed by Sam, technical setup by Karsten.
          This forum is using NodeBB as its core | Contributors
          Contact | Privacy Policy