Skip to content

JSON object #3

Description

@ValerieMichaud

Hi,
I've been trying to pass a JSON object instead of a String.
Maybe there's something i don't understand in the flow.

messages.json
{ "messages": [ { "title": "You got a new message!", "text": "Go check your WebMail.", "url": "https://ww.gmail.com" }, { "title": "Live Session", "text": "Your prof will be live on Monday, January 22 at 4pm", "url": "http://www.google.com" } ] }

index.js
function send(){ if (client) { //console.log( messages[currentMessage]) client.send(channel, messages[currentMessage]); currentMessage++; }; }

  • When i pass an object instead of a string, i don't get any console from the theClient.subscribeWithNotifications function.

service-worker.js
const notificationTitle = msg.title; const notificationOptions = { body: msg.text, icon: 'img/logo.jpg', data: { click_url: msg.url }, tag: Date.now() };

Any idea why?
Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions