<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[SocketNotification not working?]]></title><description><![CDATA[[[topic:post-is-deleted]]]]></description><link>https://forum.magicmirror.builders/topic/17927/socketnotification-not-working</link><generator>RSS for Node</generator><lastBuildDate>Fri, 12 Jun 2026 23:02:15 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/17927.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 28 Jul 2023 00:42:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to SocketNotification not working? on Fri, 28 Jul 2023 11:53:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tjat" aria-label="Profile: tjat">@<bdi>tjat</bdi></a><br />
If your calendar object is defined in a <code>named</code> function, <code>this</code> will indicate the function itself. However in that case, <code>sendSocketNotification</code> would cause an undefined function error.</p>
]]></description><link>https://forum.magicmirror.builders/post/110408</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/110408</guid><dc:creator><![CDATA[MMRIZE]]></dc:creator><pubDate>Fri, 28 Jul 2023 11:53:41 GMT</pubDate></item><item><title><![CDATA[Reply to SocketNotification not working? on Fri, 28 Jul 2023 11:25:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tjat" aria-label="Profile: tjat">@<bdi>tjat</bdi></a><br />
Could you share the whole code in Git Hub?</p>
]]></description><link>https://forum.magicmirror.builders/post/110407</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/110407</guid><dc:creator><![CDATA[MMRIZE]]></dc:creator><pubDate>Fri, 28 Jul 2023 11:25:35 GMT</pubDate></item><item><title><![CDATA[Reply to SocketNotification not working? on Fri, 28 Jul 2023 00:53:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> - It’s within the main module we’re I’m creating the calendar event. I’m following the same syntax being used above, which is working. I’ll also caveat that I’m not really experienced with this stuff so likely am doing something dumb. Am I losing the “this” reference somehow? Appreciate the help</p>
<pre><code>
      this.sendSocketNotification("ADD_CALENDAR_EVENT", payload);
      this.message = "Adding event...";
      this.messageType = "info";
      this.updateDom();
      this.closeForm();
  },

  notificationReceived: function(notification, payload, sender) {
      // TODO: Handle notifications
  },

  socketNotificationReceived: function(notification, payload) {
  if (notification === "EVENT_ADD_SUCCESS_MAIN") {
    console.log ("Sending event to calendar");
    this.showMessage('Event added!', 'success');
    if (payload) {
      this.sendNotification("EVENT_ADD_SUCCESS", payload);
    } else {
      this.sendNotification("EVENT_ADD_SUCCESS");
    }
  } else if (notification === 'EVENT_ADD_FAILED') {
    this.showMessage('Event not added', 'error');
    if (payload) {
      this.sendNotification("EVENT_ADD_FAILED", payload);
    } else {
      this.sendNotification("EVENT_ADD_FAILED");
    }
  }
},
</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/110409</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/110409</guid><dc:creator><![CDATA[tjat]]></dc:creator><pubDate>Fri, 28 Jul 2023 00:53:49 GMT</pubDate></item><item><title><![CDATA[Reply to SocketNotification not working? on Fri, 28 Jul 2023 00:44:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tjat" aria-label="Profile: tjat">@<bdi>tjat</bdi></a> said in <a href="/post/110394">SocketNotification not working?</a>:</p>
<blockquote>
<p dir="auto">this.sendSocketNotification</p>
</blockquote>
<p dir="auto">what does the ‘this’ point to ?  to module helper instance  or something else?</p>
]]></description><link>https://forum.magicmirror.builders/post/110395</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/110395</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Fri, 28 Jul 2023 00:44:29 GMT</pubDate></item></channel></rss>