mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 07:03:58 -05:00
* sse implementation that sheds stuck clients * Radek and James feedback * Refactor event streamer code for readability * less-flaky test signaling * test case where queue fills; fixes * add changelog entry * james and preston feedback * swap our Subscription interface with an alias * event.Data can be nil for the payload attr event * deepsource --------- Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
21 lines
716 B
Go
21 lines
716 B
Go
package api
|
|
|
|
import "net/http"
|
|
|
|
const (
|
|
VersionHeader = "Eth-Consensus-Version"
|
|
ExecutionPayloadBlindedHeader = "Eth-Execution-Payload-Blinded"
|
|
ExecutionPayloadValueHeader = "Eth-Execution-Payload-Value"
|
|
ConsensusBlockValueHeader = "Eth-Consensus-Block-Value"
|
|
JsonMediaType = "application/json"
|
|
OctetStreamMediaType = "application/octet-stream"
|
|
EventStreamMediaType = "text/event-stream"
|
|
KeepAlive = "keep-alive"
|
|
)
|
|
|
|
// SetSSEHeaders sets the headers needed for a server-sent event response.
|
|
func SetSSEHeaders(w http.ResponseWriter) {
|
|
w.Header().Set("Content-Type", EventStreamMediaType)
|
|
w.Header().Set("Connection", KeepAlive)
|
|
}
|