COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 12-09-2017, 12:10 PM   #1
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default Plugin 'Check For Updates' Button / Calling php from plugin

So, I'm looking into adding a button or startup check which calls a php file on my website which returns the current version number, and displays a message if it doesn't match the plugin's version.

I had a quick look, and it appears I need to learn about sockets. Before I go digging around, is there anything that already implements this in IPlug/WDL? And if not, are there any recommended libraries that are known to work well in a plugin situation?

Setting this up could also have applications for copy protection.
Bobflip is offline   Reply With Quote
Old 12-30-2017, 02:01 AM   #2
austen520
Human being with feelings
 
Join Date: Mar 2016
Posts: 6
Default

Nothing in IPlug/WDL itself that directly implements this behavior, as far as I know. You probably don't need to mess with sockets. Just send an HTTP request to your server and then interpret what the server sends back.

It looks like WDL has some code for sending HTTP requests (see httpget.h in the jnetlib folder). You could also try a more user-friendly library. A quick google search brought up https://github.com/whoshuu/cpr, which looks like it has a really simple API.
austen520 is offline   Reply With Quote
Old 01-25-2018, 12:28 AM   #3
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Hi there, sorry for the delay in replying, got a bit caught up with some other projects this month, thanks for the tips though!

Before posting the question I had already implemented a button with a link to my website, but didn't know of a way to receive anything back from the server.

I'll have a fiddle with httpget.h and see how that pans out.
Bobflip is offline   Reply With Quote
Old 01-25-2018, 10:47 PM   #4
austen520
Human being with feelings
 
Join Date: Mar 2016
Posts: 6
Default

If you've already got your server backend up and running, I don't think you should have too much trouble implementing this functionality. If I understand correctly you just need your server to give you the latest version string (eg "1.0.0") when you send a request to some url, say
Code:
bobflip.com/api/latest_version
. In that case you just need to get that (or some other, easier) library working.

Some (untested!!!) example code might look like
Code:
version_request = JNL_HTTPGet();
version_request.connect("bobflip.com/api/latest_version");
while(version_request.run()==0){
    sleep(100);
}
char* version_str = version_request.getreply();
// ...check if app version matches latest version str...
You will of course want to handle errors (e.g. if version_request.run()==-1), and you'll probably want to do something more elegant than sleeping in a while loop to wait for the response.
austen520 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:48 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.