egbokul
egbokul

Reputation: 3974

HTTP-Kit streaming and curl

I tried out the basic example for HTTP streaming of HTTP-Kit (http://www.http-kit.org/server.html#async), but if I curl to the endpoint I get all the messages at once, after the connection is closed (instead of getting them every 200ms, as it works in the browser). What's going on?

I also tried it like this:

    (schedule-task (* id 200) ;; send a message every 200ms
                   (send! channel
                          {:status 200
                           :headers {"Content-Type" "text/event-stream"
                                     "Connection" "keep-alive"}
                           :body (str "message from server #" id)}
                          false)) ; false => don't close after send

The behaviour is the same.

Upvotes: 0

Views: 269

Answers (1)

Ward
Ward

Reputation: 2852

Seems to be an issue with curl and Streaming http. According to this post, the order of options is important

Also, try using the -N, --no-buffer option

Upvotes: 1

Related Questions