Issue with sendSocketNotification and socketNotificationReceived

I’m working on a module that will allow one to send messages to a mirror via pubnub. Since my working prototype is for my wife, I’m calling the module lovenotes. Once it is polished, I intend to use it as a replacement for the random compliment module.

I’m a hobbyist and far, far, far from being a capable programmer. However, I’ve had some success.

I’m able to populate the DOM with a default message. Basically a Hello World exercise.

More significantly, I’m able to receive messages from PubNub and print them to the console. I have this process running in a node_helper.js.

But, I’m struggling with using sendSocketNotification and socketNotificationReceived (in the main module) to receive the message and update the DOM. While it appears the Notification and packet is being sent (more logging), it is never received (more logging).

I appreciate any tips. I’ve stared at the default modules and can’t seem to find anything different with my implementation of the methods.

Only had a quick look at your code but it seems like you are not sending anything from the UI JavaScript to the node_helper. In order for the node_helper to be able to communicate with the module’s JavaScript you have to open the socket connection by sending some kind of initial message to the helper first. So you can probably fix it by adding this.sendSocketNotification("hello") to the start function of your lovenotes.js.