cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Does libcurl support signal-sent event (SSE)?

From: Bruno BARRUCAND <Bruno.BARRUCAND_at_ingenico.com>
Date: Mon, 25 Aug 2014 15:21:15 +0000

Hi,
I use HTTP protocol. Server-sent events is a new function of HTML5 (Server-sent events (SSE) is a technology where a browser receives automatic updates from a server via HTTP connection).
Via libcurl, I send a request http. I want server to send data sometimes but without being locked.

I did tests and I see following things.
I can read data sent by SSE server if I set a breakpoint in function write_data. write_data is a function defined as curl_easy_setopt(curl_, CURLOPT_WRITEFUNCTION, write_data).
curl_easy_perform returns always on timeout (set to 60s).
It is as curl_easy_perform is waiting for end of message and doesn't understand it is SSE messages.
It is why I am wondering if libcurl supports Signal-Sent Event and how to use it.

Thank you,
Bruno Barrucand

-----Message d'origine-----
De : curl-library [mailto:curl-library-bounces_at_cool.haxx.se] De la part de Daniel Stenberg
Envoyé : lundi 25 août 2014 12:35
À : libcurl development
Objet : Re: Does libcurl support signal-sent event (SSE)?

On Mon, 25 Aug 2014, Bruno BARRUCAND wrote:

> I have integrated libcurl in my project. It works. Now, I want to use
> Signal-Sent Event. But does libcurl support it? If it does, how to use
> it? I am using easy interface. curl_easy_perform waits there is
> something available or a timeout has elapsed. Signal-Sent Event sends
> data without "end" and without closing the connection. So for me,
> curl_easy_perform will always return on timeout elapsed. Am I right? I
> did tests. I do a request on SSE server. I see data from SSE server
> are read by libcurl in write_data (curl_easy_setopt(curl_,
> CURLOPT_WRITEFUNCTION, write_data)). But curl_easy_perform returns always error code 28 (CURLE_OPERATION_TIMEDOUT).
> So I am wondering if libcurl supports Signal-Sent Event and how to use them.

How about speaking in plain protocol terms here. What protocol are you using?
Are you just sending "protocol data" every now and then, as part of a very long transfer?

You can for example have your read function just wait until you have data to send.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-08-25