pedestal

hanDerPeder 2026-02-12T13:56:39.996399Z

SSE has a retry field, but that doesn't seem to be supportet in io.pedestal.http.sse. https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#retry

hlship 2026-02-27T18:58:54.369579Z

This looks like something that should be handled correctly. Please add an issue for tracking purposed.

hanDerPeder 2026-02-12T13:57:30.122729Z

something like this maybe?

(def ^:private RETRY_FIELD (get-bytes "retry: "))

(defn- event->bytes
  [name data id retry]
  (let [bab (ByteArrayBuilder.)]
    (when name
      (.write bab ^bytes EVENT_FIELD)
      (.write bab ^bytes (get-bytes name))
      (.write bab ^bytes EOL))

    (when data
      (doseq [part (string/split-lines data)]
        (.write bab ^bytes DATA_FIELD)
        (.write bab ^bytes (get-bytes part))
        (.write bab ^bytes EOL)))

    (when id
      (.write bab ^bytes ID_FIELD)
      (.write bab ^bytes (get-bytes id))
      (.write bab ^bytes EOL))

    (when retry
      (.write bab ^bytes RETRY_FIELD)
      (.write bab ^bytes (get-bytes (str retry)))
      (.write bab ^bytes EOL))

    (.write bab ^bytes EOL)
    (.toByteArray bab)))

hanDerPeder 2026-02-12T13:59:01.347089Z

code currently doesn't check that anything other than EOL is actually written to the buffer (since I make data optional here)