No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. FrankM
    F
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 15
    • Best 3
    • Groups 0

    FrankM

    @FrankM

    12
    Reputation
    7
    Profile views
    15
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    FrankM Follow

    Best posts made by FrankM

    • RE: Errors updating to V2

      Check your index.template.html.

      Replace

      htmlWebpackPlugin.options.ctx.mode

      with

      ctx.mode

      posted in Help
      F
      FrankM
    • RE: How to notify users about content change in a Quasar SPA app

      Actually, you can use all techniques (service workers, websockets) in both PWAs and SPAs, it’s more a question of backend design imo.

      In my app I have a comment system. I notify users when a new comment has been posted in a thread a user has posted to or is currently viewing
      Here’s what I do:

      • when new comment is posted, i generate a notification for every user that has subscribed to the thread in the backend

      • push a message over websocket to all users that a new comment has been posted

      • when a user is currently using the app (has focus), websocket push is received by the active browser instance

      • generate a native browser event from the websocket message (new CustomEvent)

      • set up a listener for the custom event on the route where the comment thread is displayed

      • if the user is actually browsing the thread in question, just update it with the new comment

      • if not (i.e. is somewhere else in the app) and has subscribed to thread, display a QNotification or generic browser notification. Or display a counter in your navigation/toolbar, depends on you app

      • if the user reads the new comment (set up a scroll observer / intersection, Quasar has nice features for this), inform the backend about this and delete the notification on the backend if user has a subscription to thread

      • setup cronjob on backend for notifications not “seen” by the user (like every 5 minutes)

      • send a push message over firebase to subscribers

      • service worker in my app listens to firebase messages and generates a push message

      • when user reacts to push and navigates to the thread, this is handled by QIntersection and backend is informed that the user has “seen” the comment (like before)

      • after 30 minutes, send out E-Mail notification from backend

      This is probably overengineered for a simple “content updated” thing

      The basic approach is: notify active user via websocket, inactive user via push, offline users via E-Mail. Don’t do it all at once, this is super annyoing. Keep track in your backend about notifications actually being read

      Implement “priorities”. For example, I dont’t send push messages via firebase when someone has not actively subscribed to a thread. But I do of course update the UI when the user is browsing the thread currently

      posted in Help
      F
      FrankM
    • RE: Quasar 1.12.9 released!

      Thank you

      posted in Announcements
      F
      FrankM

    Latest posts made by FrankM

    • RE: Quasar v2.0.0-beta.1 released! Vue 3, here we come!

      How long do you plan to support V1.x?

      posted in Announcements
      F
      FrankM
    • RE: Quasar v1.13.0 released! Countless new features (and Morph directive!)

      Wow thank you!

      posted in Announcements
      F
      FrankM
    • RE: Get strings from Ajax and make certain words clickable

      It can be done with Vue.compile(), but there are certain caveats you need to be aware of. This may point you to the right direction: https://stackoverflow.com/questions/46584301/vue-components-elements-in-v-html

      posted in Help
      F
      FrankM
    • RE: Razvan is taking some time off

      @rstoenescu Glad you have recovered! All the best!

      posted in Announcements
      F
      FrankM
    • RE: How to notify users about content change in a Quasar SPA app

      @Mickey58 Nice. I find websockets more fitting for UI update tasks than push notifications/service workers. The latter one are really only important if you need to notify users that are not currently using your app.

      posted in Help
      F
      FrankM
    • RE: How to notify users about content change in a Quasar SPA app

      @dobbel

      To listen to firebase messages you would setup somthing like:

      firebase.js boot file

      import * as firebase from "firebase/app"
      import "firebase/messaging"
      
      firebase.initializeApp({
          apiKey: process.env.FIREBASEKEY,
          authDomain: "my-app.firebaseapp.com",
          projectId: "my-app",
          messagingSenderId: "123456780",
          appId: "myappid"
      })
      
      
      export default ({Vue}) => {
          Vue.prototype.$messaging = firebase.messaging()
          Vue.prototype.$messaging.usePublicVapidKey(myPublicVapid)
      }
      

      In created hook on app level/main layout component:

      this.$messaging.onMessage((msg) => { //listen to firebase
      const ev = new CustomEvent(msg.data.identifier, { //msg.data is backend defined payload
                      detail: msg.data, 
                      bubbles: true,
                      cancelable: true
                   });
                   const handled = !document.dispatchEvent(ev) //fire event
                   if (handled) { 
                      //event has been handled/consumed by another (child) component in the app
                   } else {
                      //handle event on app level if needed, e.g. fallback to generic browser notification
                   }
      })
      
      posted in Help
      F
      FrankM
    • RE: How to notify users about content change in a Quasar SPA app

      @dobbel I send websocket messages first to “connected” users and firebase pushs to users not active for 5 minutes or so. For simple UI updates I only use websockets only (like updating counters and stuff)

      On the client, I subscribe to the websocket messages (I use vue-wamp) and upon receiving, I fire a native browser event that can be handled by regular event listeners. This is set up in a “created” hook on app level or main layout, i.e. components that are always active when the app has been initialized and has focus.

      $wamp is globally exported to my components by a Quasar boot file

      this.$wamp.subscribe('myChannel', function (payload, args, event) {
                   const data = payload[0]; //custom data sent from the backend via websocket
                   var ev = new CustomEvent(data.identifier, { 
                      detail: data, //pass the backend payload to the custom event also
                      bubbles: true,
                      cancelable: true
                   });
                   const handled = !document.dispatchEvent(ev) //fire event
                   if (handled) { 
                      //event has been handled/consumed by another (child) component in the app
                   } else {
                      //handle event on app level if needed, e.g. fallback to generic browser notification
                   }
                }
      

      In a component, I create event-handler like:

      created() {
         document.addEventListener("my-event-identifier", this.eventHandler, false)
      },
      beforeDestroy() {
         document.removeEventListener("my-event-identifier", this.eventHandler, false)
      },
      methods: {
         eventHandler(event) {
            console.log(event.detail)
            //do stuff with event
         }
      }
      
      posted in Help
      F
      FrankM
    • RE: How to notify users about content change in a Quasar SPA app

      A nice thing is that you can implement event listeners on specific routes/components and a more generic event handling on app/main layout level to act as fallback in case the handler on the specific route did not trigger because the user is on another route. Just make sure you setup listeners onMounted() or onCreate() and remove them before the component is destroyed

      posted in Help
      F
      FrankM
    • RE: Errors updating to V2

      @metalsadman Sorry, I must have missed that 😉

      posted in Help
      F
      FrankM
    • RE: How to notify users about content change in a Quasar SPA app

      Actually, you can use all techniques (service workers, websockets) in both PWAs and SPAs, it’s more a question of backend design imo.

      In my app I have a comment system. I notify users when a new comment has been posted in a thread a user has posted to or is currently viewing
      Here’s what I do:

      • when new comment is posted, i generate a notification for every user that has subscribed to the thread in the backend

      • push a message over websocket to all users that a new comment has been posted

      • when a user is currently using the app (has focus), websocket push is received by the active browser instance

      • generate a native browser event from the websocket message (new CustomEvent)

      • set up a listener for the custom event on the route where the comment thread is displayed

      • if the user is actually browsing the thread in question, just update it with the new comment

      • if not (i.e. is somewhere else in the app) and has subscribed to thread, display a QNotification or generic browser notification. Or display a counter in your navigation/toolbar, depends on you app

      • if the user reads the new comment (set up a scroll observer / intersection, Quasar has nice features for this), inform the backend about this and delete the notification on the backend if user has a subscription to thread

      • setup cronjob on backend for notifications not “seen” by the user (like every 5 minutes)

      • send a push message over firebase to subscribers

      • service worker in my app listens to firebase messages and generates a push message

      • when user reacts to push and navigates to the thread, this is handled by QIntersection and backend is informed that the user has “seen” the comment (like before)

      • after 30 minutes, send out E-Mail notification from backend

      This is probably overengineered for a simple “content updated” thing

      The basic approach is: notify active user via websocket, inactive user via push, offline users via E-Mail. Don’t do it all at once, this is super annyoing. Keep track in your backend about notifications actually being read

      Implement “priorities”. For example, I dont’t send push messages via firebase when someone has not actively subscribed to a thread. But I do of course update the UI when the user is browsing the thread currently

      posted in Help
      F
      FrankM