Skip to content

Commit

Permalink
(NOBIDS) disable compression for sse (#2907)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbitfly authored Jul 2, 2024
1 parent 34395a1 commit 0f34640
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rpc/lighthouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ func NewLighthouseClient(endpoint string, chainID *big.Int) (*LighthouseClient,

func (lc *LighthouseClient) GetNewBlockChan() chan *types.Block {
blkCh := make(chan *types.Block, 10)
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/eth/v1/events?topics=head", lc.endpoint), nil)
if err != nil {
logger.Fatal(err, "error initializing event sse request", 0)
}
// disable gzip compression for sse
req.Header.Set("accept-encoding", "identity")

go func() {
stream, err := eventsource.Subscribe(fmt.Sprintf("%s/eth/v1/events?topics=head", lc.endpoint), "")
stream, err := eventsource.SubscribeWithRequest("", req)

if err != nil {
utils.LogFatal(err, "getting eventsource stream error", 0)
Expand Down

0 comments on commit 0f34640

Please sign in to comment.