Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WRITEFUNCTION #18

Open
pprocacci opened this issue Oct 15, 2020 · 1 comment
Open

WRITEFUNCTION #18

pprocacci opened this issue Oct 15, 2020 · 1 comment
Assignees

Comments

@pprocacci
Copy link

It's be nice if this (and perhaps the corresponding READFUNCTION libcurl options were made available to the end user.

I've got an application sending chunked responses which does so upon events occuring on the server.
The connection is kept-alive and data arrives from every 1 second, to maybe never.
The connection never gets torn down.

This module lacks the ability to receive these partial messages and it appears it just buffers them until a full response is received.
Being able to set my own handler would be kinda nice.

If this option exists, I apologize in advance. I looked through the source code and was unable to find anything that would indicate a function pointer exists for such a thing. (There is a call to CURLOPT_WRITEFUNCTION but it's hard-coded pointing to a sub).

@CurtTilmes CurtTilmes self-assigned this Oct 15, 2020
@CurtTilmes
Copy link
Owner

I played around with this a long time ago, but never got it to a state I really like.

Instead of using callbacks, I wanted to use a Raku Channel to stream the data.

You can try the not quite prime-time work like this:

my $curl = LibCurl::Easy.new(URL => ...);

my $stream = $curl.stream-out;

start react whenever $stream -> $in {
        say "in: ", $in;
}

$curl.perform;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants