snfk
16 July 2021 12:45
1
I need to do a GET request from my plugin and was wondering if there was a built-in method for this. If not, any suggestions on how to do this?
you can use jnetlib from WDL
/*
** JNetLib
** Copyright (C) 2008 Cockos Inc
** Copyright (C) 2000-2001 Nullsoft, Inc.
** Author: Justin Frankel
** File: httpget.h - JNL interface for doing HTTP GETs.
** License: see jnetlib.h
**
** Usage:
** 1. Create a JNL_HTTPGet object, optionally specifying a JNL_AsyncDNS
** object to use (or NULL for none, or JNL_CONNECTION_AUTODNS for auto),
** and the receive buffer size, and a string specifying proxy (or NULL
** for none). See note on proxy string below.
** 2. call addheader() to add whatever headers you want. It is recommended to
** add at least the following two:
** addheader("User-Agent:MyApp (Mozilla)");
*/// addheader("Accept:*/*");
/* ( the comment weirdness is there so I Can do the star-slash :)
** 3. Call connect() with the URL you wish to GET (see URL string note below)
** 4. Call run() once in a while, checking to see if it returns -1
This file has been truncated. show original
1 Like
snfk
16 July 2021 18:46
3
Where should I perform the GET request at? I’ve created an API to get a json list that will be displayed using IText on a control.
Well, definitely not on the audio thread. If you need the data even if the UI isn’t opened then not in an IControl. I expect you should do it on a new thread so as not to pause the main thread. You could do that in OnIdle(), but make sure it doesn’t do more work than nessecary (keep track of the status).