artanis
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: http-request in a controller- is it possible?


From: Nala Ginrut
Subject: Re: http-request in a controller- is it possible?
Date: Mon, 07 Dec 2020 13:23:37 +0800
User-agent: mu4e 1.4.13; emacs 27.1

Hi Jaft!

Jaft writes:

>  Gotcha; so something like?
> (get "/test-endpoint" #:mime #t  (lambda (rc)    (display "Something here")   
>  (newline)
>     (break-task)    (receive (headers body)        (http-get 
> "http://127.0.0.1:3000/other-endpoint";)      (display "JSON: ")      (display 
> (utf8->string body))      (newline))
>     (:mime rc '(("this is the " . "first endpoint we call")))))
> Unfortunately, I get the same result of
> Enter ragnarok scheduler!Save current task #<ragnarok-client treasure: 
> (#<input-output: socket 34> . #(2 2130706433 60016))>!Add new task 
> #<input-output: socket 34> == #<input-output: socket 34>Save okServe one 
> donemain-loop again
> outputted by art, as before.
> Or is that because http-get freezes and hangs, even with Ragnarok, currently?
> Jonathan    On Sunday, December 6, 2020, 12:12:31 AM CST, Nala Ginrut 
> <mulei@gnu.org> wrote:

You don't have to call (break-task) here manually, since Ragnarok will
schedule it for you. As I mentioned in previous mails, there should be
client API in Artanis in the future, for now, you have to set the port
to non-blocking by yourself.

--------------------------cut--------------------------------------
(define port (open-socket-for-uri "http://localhost:3000/123";))
(fcntl port F_SETFL (logior O_NONBLOCK (fcntl port F_GETFL 0)))
(http-get "http://......."; #:port port)
--------------------------end--------------------------------------




--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]