• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Notification system

Community Beginner ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

Hi all,

I'd like to add a notification system in my plugin. Currently, I send email to photographers when something happens.
But I'd like to allow them to choose either email or notification and show popup instead of emails.

I was thinking to add a task to send a request to my server every hour or so (with an infinite loop and sleep). But I'm not sure that it's nice and efficient.

Any ideas? Or perhaps that Lightroom sdk provide something?

Thank you
Cheers

TOPICS
SDK

Views

532

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 18, 2017 Sep 18, 2017

Copy link to clipboard

Copied

Your plugin can open a dialog at any point with LrDialogs.presentModalDialog() or .message(), even if the plugin is running in background. 

If you want to use the operating system's notification mechanism, your plugin could invoke a command-line program.  A quick Google suggests:

Mac: macos - Send notification from command line - Ask Different

Windows: Plastic SCM blog: How to send Windows Toast notifications from Console apps

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

Yes, that is true.
My problem was more about how to do it from my server to Lightroom.

We could do polling : every X minutes send a REST request to my server to see if I need to show notification
But it means that I send tons of request to my server. Not very efficient.

Any clue on this?
Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

More often than not, the actual fraction of network bandwidth and CPU consumed by the polling would be negligible.  Trying to avoid polling is understandable, but properly designed polling usually doesn't have a practical impact.

To avoid polling, your plugin could open a long-running HTTP request to the server, and the server only replies when it has something to say.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

Thank you John for your reply.

Do you have any example to get a properly designed polling?

Or for a long-running HTTP?

Thank you so much for your help,
Martin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

LATEST

Re polling, I haven't implemented anything in the LR context with HTTP.  But as a thought experiment, suppose your plugin sent a request once a minute to your server, and usually the response was "Nothing available".  For a single client, the increase in CPU on client and server and bandwidth wouldn't be measurable, I think. But as you increase the number of clients, it might turn into a real cost on the server.  But a modern Web server can handle ten small requests/second without blinking an eye. 

Re a long-running HTTP request, HTTP 1.1 connections are by default persistent, but they time-out after inactivity (based on default settings of most Web servers, I think).   So you'd either have to change the default setting on your Web server or have the plugin send application-level keep-alive messages when there's no activity.  Sending keep-alive messages would still be less expensive in CPU and bandwidth than polling HTTP requests, since you wouldn't have the overhead of the three-way handshake of opening and then closing TCP connections.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines