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.

    Share Payload between modules

    Scheduled Pinned Locked Moved General Discussion
    4 Posts 3 Posters 404 Views 3 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.
    • mumblebajM Offline
      mumblebaj Module Developer
      last edited by

      Hi Guys,

      Is there a way to share the payload between modules? I.e. have one module do a GET request and then share the payload it receives with another module? As I understand it, the sendSocketNotification is only valid within it’s own scope/module and cannot be intercepted by another module. At least this was what I understood from another post I read a while back.

      I have two modules and they both run off the same payload and would like to share this between the two rather than make two calls.

      If this is possible, please advise how.

      Thanks

      Check out my modules at: https://github.com/mumblebaj?tab=repositories
      Check my blog-post: https://mumblebaj.xyz/

      M S 2 Replies Last reply Reply Quote 0
      • M Offline
        MMRIZE @mumblebaj
        last edited by

        Use sendNotification() in socketNotificationReceived() of one module to deliver payload from its nodeHelper to another module.

        1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @mumblebaj
          last edited by

          @mumblebaj you would have to send it up to your modulename.js, which can then broadcast it to the other modules using sendNotification()/notificationReceived(). socketnotifications are only between the modulename.js and the modules node_helper.

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          mumblebajM 1 Reply Last reply Reply Quote 0
          • mumblebajM Offline
            mumblebaj Module Developer @sdetweil
            last edited by

            Thanks @sdetweil and @MMRIZE , that worked a charm. :-)

            Check out my modules at: https://github.com/mumblebaj?tab=repositories
            Check my blog-post: https://mumblebaj.xyz/

            1 Reply Last reply Reply Quote 0
            • 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