question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to get the local-notification immediately without any delay when a message received from websocket

See original GitHub issue

I am trying to push notification message from webserver to my mobile client using websocket. on my websocket onmessage received event i am showing up a local-notification using the plugin(“nativescript-local-notifications”) here is the code i used

LocalNotifications.schedule([{
           id: 1,
           title: 'New Message from websocket' ,
           body: 'Test message',
           ticker: 'The ticker',
           ongoing: true, // makes the notification ongoing (Android only)
           sound: "customsound-ios.wav", // falls back to the default sound on Android
           at:new Date()  //same behaviour when comment out  this line
         }]).then(
             function() {
               console.log("Notification scheduled");
             },
             function(error) {
               console.log("scheduling error: " + error);
             }
         )
       });

using the above code i am getting local-notification 5secs after the websocket onmessage received event. but if i use the same code inside the button tap event i am getting the local-notification immediately. any help or troubleshooting tips is highly appreciated.

Regards, Boobalakannan

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ghostcommented, Feb 26, 2018

Thanks Nicklliev. it works well. after cloned the application deleted my previous version of the application from my device removed the node_modules, platforms and hooks folders rebuild and redeployed the application with run android

1reaction
NickIlievcommented, Feb 26, 2018

@BoobalakannanSubbaiyan the issue is not reproducible on our side when the at key is removed - here you can find a sample project used with nativescript-local-notifications and nativescript-websockets.

Read more comments on GitHub >

github_iconTop Results From Across the Web

delay websocket updates and show the message later on?
I use websockets and pusher api to tackle the live updates, this works perfectly when player is "online". But what if they are...
Read more >
Duplicate iOS companion app notifications
I'm receiving duplicate notifications for some of my automations. ... can receive push notifications directly (when on your home network).
Read more >
Scripting API: ConnectionConfig - Unity - Manual
If the server were to send an acknowledgement immediately after receiving each ... significant delaying of message delivering and can make game unplayable....
Read more >
Local Notifications: iOS & Android - Ionic Framework
The Cordova Local Notifications Plugin allows you to display local notifications from your Ionic Framework application on iOS, Android, or Windows devices.
Read more >
Open Client API - Pushover
Pushover now features a public client API for advanced users to write their ... message confirms that you are now able to receive...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found