Incorrect subscription id
RexCloud opened this issue · 4 comments
RexCloud commented
Description
SubscriptionStream from eth_subscribe
to Alchemy RPC will have incorrect subscription id
Incorrect subscription id makes unsubscribing impossible
I tried this code:
let mut stream = provider_ws_alchemy.subscribe_blocks().await.unwrap();
println!("{}", stream.id);
// eth_subscribe response: {"id":0,"result":"0xf13f7073ddef66a8c1b0c9c9f0e543c3","jsonrpc":"2.0"}
I expected to see this happen: 0xf13f7073ddef66a8c1b0c9c9f0e543c3 or U256 representation
Instead, this happened: 0
mattsse commented
what's incorrect here exactly?
you get the identifier of the subscription as the result, no?
RexCloud commented
what's incorrect here exactly? you get the identifier of the subscription as the result, no?
I get the identifier, but it's from "id" key of response, not from "result" key
mattsse commented
id
corresponds to the request id of the eth_subscription
request, the subscription id is the result