erigon-pulse/cl/beacon/validatorapi/events.go

24 lines
467 B
Go

package validatorapi
import (
"net/http"
"github.com/gfx-labs/sse"
)
func (v *ValidatorApiHandler) GetEthV1Events(w http.ResponseWriter, r *http.Request) {
sink, err := sse.DefaultUpgrader.Upgrade(w, r)
if err != nil {
// OK to ignore this error.
return
}
topics := r.URL.Query()["topics"]
for _, topic := range topics {
sink.Encode(&sse.Event{
Event: []byte(topic),
Data: nil,
})
// OK to ignore this error. maybe should log it later
}
}