Hi,
I used the following code and run it in a separate java thread, then connect to mainnet.infura.io/my_token, but I got Invalid response received exception, also from the httpService log, it shows 405 Method Not Allowed, any clue?
Thanks
CountDownLatch countDownLatch = new CountDownLatch(EVENT_COUNT);
CountDownLatch completedLatch = new CountDownLatch(EVENT_COUNT);
Subscription subscription = observable.subscribe(
x -> {
countDownLatch.countDown();
logger.debug("Monitoring enter run. observable x: " + x);
},
e -> {
logger.error("exception occurred in subscription tx", e);
},
() -> {
completedLatch.countDown();
}
);
I also tried with ropsten.infura.io, but still the same exception, also tried this code and get the same error:
Subscription subscription = web3j.blockObservable(false).subscribe(block -> {
System.out.println("Sweet, block number " + block.getBlock().getNumber() + " has just been created");
}, Throwable::printStackTrace);
TimeUnit.MINUTES.sleep(2);
subscription.unsubscribe();
My web3Client version return is Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9.2.
I am using web3j 3.3.1.
Thanks
These methods use filters behind the scenes that are not supported by Infura. Please refer to the docs for more info.
Most helpful comment
These methods use filters behind the scenes that are not supported by Infura. Please refer to the docs for more info.