0

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.

egbokul
  • 3,944
  • 7
  • 36
  • 54

1 Answers1

1

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

Ward
  • 2,802
  • 1
  • 23
  • 38
  • My bad, I just missed the possibility of the messages being too short - if I add some more characters to the message the -N option is not even necessary. – egbokul Nov 11 '15 at 15:19