MagicMirror: this.sendSocketNotification is not a function
I have just about finished my Traffic module to get current commute time, but Iโm having difficulty sending a socket notification other than the initial one in my start
function. The project can be found here and the issue lies in MMM-Traffic.js
.
I send a socket notification in start
which queries the google maps api in node_helper.js
then sends a socket notification back to MMM-Traffic.js
which will then call updateDom()
. Iโm using updateCommute()
as a proxy for setInterval that will send the initial socket notification at the user defined interval, but I am getting an error saying that this.sendSocketNotification is not a function. Any ideas?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 81 (20 by maintainers)
Commits related to this issue
- Fix socket reference bug. #196 — committed to MagicMirrorOrg/MagicMirror by MichMich 8 years ago
Donโt forget to add your module to the wiki, so that others can find it! Will give it a try later, thanks for your work!
@paviro: If in the handler itself you donโt need the original
this
you can override it like this.or
Great! Everything is working now. Thanks again for your help!
(Until someone opens the interface twice in multiple browsers. Then the shit hits the fan. ๐)
The Log.log helper does not work in the node helper as you might have noticed. ๐
Should work.
Note: to send a notification from the node helper to the front end, the frontend first needs to send a message (to open the connection.)