-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nebulas RPC subscribe interface issue #61
Comments
Hi Larry, How's this issue? Any updates? |
Any update? |
Goal: Reliably listen to event (emit by specific Smart Contract)For Example: NRC20 token, Following code come from official doc transfer: function (to, value) {
value = new BigNumber(value);
var from = Blockchain.transaction.from;
var balance = this.balances.get(from) || new BigNumber(0);
if (balance.lt(value)) {
throw new Error("transfer failed.");
}
this.balances.set(from, balance.sub(value));
var toBalance = this.balances.get(to) || new BigNumber(0);
this.balances.set(to, toBalance.add(value));
this.transferEvent(true, from, to, value); // <--------------How do I listen to this?
}, Example: user transfer NAS to a Nebulas wallet address that we provide(n1...something)We need to know that when that happen. it's like a webhook. |
Seem like I can't subscribe to specific one Smart Contract? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nebulas subscribe interface using the long connection, RPC using gRPC connection, the long connection by a stream can work well. However, in the HTTP request, using the keep-alive can request but don't return data.
gRPC usage
http usage
curl
and the JS implementation of theRPC
don't seem to return the data properly because the data is encoded in chunks.Anybody has a better way to handle the Subscribe via http?
issue
The event emitter is a non-blocking design, evnent data will be lost when the channle is full when there are many subscribed events. Since the RPC stream is sent serially, the message is not delivered in time. We need a non-blocking pipeline for event collection. Can anyone alse take this job, using kafka, redis, etc as the adapter?
The events in event trie May not response in Subscribe, This may be a bug in event emitter.
The text was updated successfully, but these errors were encountered: