cURL / Mailing Lists / curl-users / Single Mail

curl-users

How to implement long-polling using curl-command-line?

From: AC Pan <acpan22_at_gmail.com>
Date: Mon, 27 Oct 2014 18:52:06 +0800

Thanks for your time reading this. I had searched the forum but can't seems
to find a way to do this. I also searched extensively in the internet
trying to implement using other approaches but did not get it work or too
difficult for my level using .

I am trying to implement push notification from a web server using
long-polling like https://github.com/panique/php-long-polling, except that
the client is originated from curl.exe NOT a web browser.

Ideally using long-polling approach, the curl.exe client should be able to
send a HTTP GET/Post to the Server, STAY CONNECTED for the session until
there is new data from the server.

When new data is available, the server return with 1 and some other data
from a database, and the connection is closed and the curl client write the
data to a file or trigger an external program on the PC.

This way, it will reduce the load and traffic without fixed interval
polling from the client.

Questions:

1. Can curl connect to a php server and have the connection stay with the
server until data arrive? How to do it ? i tested Curl.exe, the connection
does not stay. May be i am not aware of syntax used.

 2. If not possible to implement above, how about running an external
program that act as a long polling desktop client? what desktop client can
be use?

Many thanks again if you guys can offer any advice.

Best Regards,
AC Pan

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-10-27