【问题标题】:HTTP-Kit streaming and curlHTTP-Kit 流式传输和 curl
【发布时间】:2015-11-11 14:12:51
【问题描述】:

我尝试了 HTTP-Kit (http://www.http-kit.org/server.html#async) 的 HTTP 流的基本示例,但是如果我将 curl 发送到端点,我会在连接关闭后立即获取所有消息(而不是每次都获取它们200ms,因为它在浏览器中工作)。这是怎么回事?

我也试过这样:

    (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

行为是一样的。

【问题讨论】:

    标签: clojure http-kit


    【解决方案1】:

    似乎是 curl 和 Streaming http 的问题。根据this的帖子,选项的顺序很重要

    另外,尝试使用 -N, --no-buffer 选项

    【讨论】:

    • 我的错,我错过了消息太短的可能性 - 如果我在消息中添加更多字符,甚至不需要 -N 选项。
    猜你喜欢
    • 2011-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多