Hi!
I'm trying to subscribe to logs, however getting an immediate not-supported response. Is there something I'm doing wrong in the setup below, or is this simply something that is not yet implemented?
Current go-ethereum master, f322859.
The following code:
rc, err := rpc.Dial(...)
// error is nil
ec := ethclient.NewClient(rc)
logs := make(chan vm.Log)
fq := ethereum.FilterQuery{
Addresses: []common.Address{someAddr},
}
sub, err := ec.SubscribeFilterLogs(context.TODO(), fq, logs)
if err != nil {
log.Println("Subscribe:", err) // <-- Subscribe: notifications not supported
return
}
No error, subscription to listen on
Error :(
Code as above.
rc, err := rpc.Dial(...)
If ... is a http:// URL subscriptions will not work. We'd need to implement a fallback using polling filters but that's not done yet.
Subscribe* should work with ws:// and ipc (unix socket, named pipe).
Ah, yes, it was HTTP. I'll retry wit with websockets or IPC, thanks!
Most helpful comment
If
...is ahttp://URL subscriptions will not work. We'd need to implement a fallback using polling filters but that's not done yet.Subscribe* should work with
ws://and ipc (unix socket, named pipe).