0

I'm trying to subscribe to events logs to handle Transfer(address,address,uint64) events. I've followed this example.

https://github.com/miguelmota/ethereum-development-with-go-book/blob/master/en/event-subscribe/README.md

However, when there are no incoming events I get an EOF error and the app quits. I tried to prevent the app quitting by removing the log.Fatal(err). However, any subsequent JSON-RPC call to the blockchain will result in write tcp xx.xx.xx.xx:42542->xx.xx.xx.xx:443: i/o timeout errors. Is there any way to close the socket gracefully without quitting the app?

Basically what I want to do is to continuously subscribe to the event and recover from any errors.

  • can't you just add a check for if err == io.EOF? – Miguel Mota Mar 21 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.