Skip to content
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

Added slot update subscribe and unsubscribe #88

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pSN0W
Copy link
Collaborator

@pSN0W pSN0W commented Nov 29, 2022

This pr implements the functions onSlotUpdate and removeSlotUpdateListener associated with #41 The aim here is to get notification whenever any of the slot is updated.

@@ -1137,6 +1137,31 @@ int WebSocketSubscriber::onAccountChange(const solana::PublicKey &pub_key,
void WebSocketSubscriber::removeAccountChangeListener(RequestIdType sub_id) {
sess->unsubscribe(sub_id);
}

int WebSocketSubscriber::onSlotUpdate(Callback callback,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params should be an input variable for all of the methods.

};
int sub_id = sub.onSlotUpdate(on_callback, solana::Commitment::CONFIRMED,
on_subscribe, on_unsubscribe);
sleep(10);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid sleep in all your code. Use futures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants