REST VC: Subscribe to Beacon API events (#13354)

* Initial code for head event streaming

* handle events and error

* keepalive event

* tests

* generate new mock

* remove single case select

* cleanup

* explain eventByteLimit

* use 2 channels in test

* review

* more review

---------

Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
This commit is contained in:
Radosław Kapka
2024-01-04 18:14:45 +01:00
committed by GitHub
parent cfef8f4676
commit e68b2821c1
25 changed files with 351 additions and 49 deletions

View File

@@ -26,6 +26,7 @@ import (
gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/pkg/errors"
fastssz "github.com/prysmaticlabs/fastssz"
"github.com/prysmaticlabs/prysm/v4/api"
"github.com/prysmaticlabs/prysm/v4/api/gateway"
"github.com/prysmaticlabs/prysm/v4/api/server"
"github.com/prysmaticlabs/prysm/v4/async/event"
@@ -851,7 +852,7 @@ func (c *ValidatorClient) registerRPCGatewayService(router *mux.Router) error {
},
}),
gwruntime.WithMarshalerOption(
"text/event-stream", &gwruntime.EventSourceJSONPb{}, // TODO: remove this
api.EventStreamMediaType, &gwruntime.EventSourceJSONPb{}, // TODO: remove this
),
gwruntime.WithForwardResponseOption(gateway.HttpResponseModifier),
)