Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON object #3

Open
ValerieMichaud opened this issue Jan 24, 2018 · 0 comments
Open

JSON object #3

ValerieMichaud opened this issue Jan 24, 2018 · 0 comments

Comments

@ValerieMichaud
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant