<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Yarden Even</title>
    <description>The latest articles on DEV Community by Yarden Even (@yarduza).</description>
    <link>https://dev.to/yarduza</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F645148%2F0251f083-08a8-491d-ba1f-28b140450f06.jpg</url>
      <title>DEV Community: Yarden Even</title>
      <link>https://dev.to/yarduza</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yarduza"/>
    <language>en</language>
    <item>
      <title>How do you implement notifications?</title>
      <dc:creator>Yarden Even</dc:creator>
      <pubDate>Sun, 13 Jun 2021 16:53:53 +0000</pubDate>
      <link>https://dev.to/yarduza/how-do-you-implement-notifications-41jo</link>
      <guid>https://dev.to/yarduza/how-do-you-implement-notifications-41jo</guid>
      <description>&lt;p&gt;Checking the collective wisdom for ways of improvement.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What's your solution?&lt;/li&gt;
&lt;li&gt;How do you treat read notifications?&lt;/li&gt;
&lt;li&gt;Do you use email and mobile notifications?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I use raw Firestore. I created a notifications collection with user documents that restricts access only to the user using the Firestore policies.&lt;/p&gt;

&lt;p&gt;In view I created a "notification center" where all notifications are gathered.&lt;/p&gt;

&lt;p&gt;On the backend I built several notification types. I send the relevant type to Firestore using the admin SDK, saved under the relevant receiving user. There's also a sender field. The whole thing is being managed by an internal notification service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;CoLearnRequestNotification&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ID&lt;/span&gt;                  &lt;span class="kt"&gt;string&lt;/span&gt;              &lt;span class="s"&gt;`json:"ID"`&lt;/span&gt;
    &lt;span class="n"&gt;ActionID&lt;/span&gt;            &lt;span class="kt"&gt;string&lt;/span&gt;              &lt;span class="s"&gt;`firestore:"actionID" json:"actionID"`&lt;/span&gt;
    &lt;span class="n"&gt;Type&lt;/span&gt;                &lt;span class="kt"&gt;string&lt;/span&gt;              &lt;span class="s"&gt;`firestore:"type" json:"type"`&lt;/span&gt;
    &lt;span class="n"&gt;CreatedAt&lt;/span&gt;           &lt;span class="kt"&gt;string&lt;/span&gt;              &lt;span class="s"&gt;`firestore:"createdAt" json:"createdAt"`&lt;/span&gt;
    &lt;span class="n"&gt;Requester&lt;/span&gt;           &lt;span class="n"&gt;User&lt;/span&gt;                &lt;span class="s"&gt;`firestore:"requester" json:"requester"`&lt;/span&gt;
    &lt;span class="n"&gt;Read&lt;/span&gt;                &lt;span class="kt"&gt;bool&lt;/span&gt;                &lt;span class="s"&gt;`firestore:"read" json:"read"`&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the front-end I use a Firestore listener. I use VueFire and VuexFire since I'm on VueJS. I store them in the Vuex store.&lt;/p&gt;

&lt;p&gt;In order for a notification to be considered as "read", the user has to click an "x" button and remove it from the notification gadget.&lt;/p&gt;

&lt;p&gt;Email: Currently building an internal email service. Mobile: we don't have a mobile app... yet.&lt;/p&gt;

</description>
      <category>firebase</category>
      <category>go</category>
      <category>vue</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
