Go-ethereum: ethclient: SubscribeFilterLogs returns "notifications not supported"

Created on 18 Nov 2016  路  2Comments  路  Source: ethereum/go-ethereum

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?

System information

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
    }

Expected behaviour

No error, subscription to listen on

Actual behaviour

Error :(

Steps to reproduce the behaviour

Code as above.

Most helpful comment

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).

All 2 comments

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!

Was this page helpful?
0 / 5 - 0 ratings