Archived Forum Post

Index of archived forum posts

Question:

HTTP or REST? Which to use?

Oct 24 '16 at 13:32

Would you have a few minutes to suggest the best Chilkat control for what I'm doing? Right now I'm using the HTTP control, primarily because of the async methods that it has. I'm mostly sending JSON to and from my main server.

I have a connection which is used for HTTP long polling. It connects to the server and basically says "here's my site id and password. I'm going to wait for you to send me something..." It holds the connection open for 45 minutes and if it receives nothing, it closes itself and re-connects. If it does receive a response from the server, it processes the response, drops the connection and reconnects. My question here is, would the REST control be a better fit than the HTTP control?

The other connections are just basic HTTP POSTs or GETs and the standard HTTP control seems to work fine for these.

Lastly, I haven't been able to wire up the ActiveX events interface with any success yet for HTTP control. Not sure what I'm missing... Right now i have a timer that checks for the status of "Finished = 1" and then acts on it, which works, bound an event bound model would be better. I have the interface implemented in my VFP code and it's bound using VFP's EVENTHANDLER, but none of the events actually fire. Also, I wasn't clear from the documentation, which object the events were to be bound to, is it the task object or the http one?


Answer

These are good questions, and I'll give you my thoughts in no particular order..

Those are my thoughts for now.. hope it helps.


Answer

Yes, I am using the methods that end with Async. PostJsonAsync specifically.

Thanks for the clarification on using REST vs. HTTP.

I've used EventHandler before to work with other COM events, but I can't say that I've used it in conjunction with a COM object that runs in background thread. VFP returns true for the EventHandler line binding properly, but none of the events actually fire. I made sure that the system setting for AutoYield was on as well. No luck. Based on your last statement, a VFP timer, polling for results may actually be the only way to do what I need to do.

Thanks.