Read the statement by Michael Teeuw here.
Need helping sending notifications between module and module node_helper
-
@sdetweil Basically reading a folder to return all of the files contained inside. But for testing purposes I was just printing to see if the sendSocketnotification and socketNotificationReceived were actually reaching each other through each js file. I have already created the code to get each file but I had issues sending the data through socketNotifications, hence the small files I had created and sourced here to show what I had attempted.
All I actually need is for someone to assist me by pointing me in the right direction to prove that the notifications are being sent and received correctly.
Thanks for your reply. -
@seann node_helper.js uses console.log, and the output shows in the console window where you did npm start dev
the module.js uses Log.log() and the output shows up in the console tab of the developers window started with npm start dev or ctrl-shift-i (letter i)
-
-
@sdetweil Nevermind, received the notification now somehow. Thank you for your help.
-
@seann and u really should wait til you get the “ALL_MODULES_STARTED” notification before starting communications between components… .like this
// helper.js var helper; Module.register("helper", { defaults: { }, start: function(){ helper = this; Log.info("Started Module: " + helper.name); }, notificationReceived: function (notification, payload) { if(notification ==="ALL_MODULES_STARTED") helper.sendSocketNotification('helper_notification', {}); }, socketNotificationReceived: function(notification, payload){ Log.info("Helper Recieved notification: " + notification); } });
also, if you use Log.error() in the module,the messages will be easier to find in early development
-
@sdetweil Perfect, thank you! :)