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

Unsubscribe streams #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Unsubscribe streams #37

wants to merge 1 commit into from

Conversation

Eligioo
Copy link
Member

@Eligioo Eligioo commented Jan 21, 2025

By adding a specialised unsubscribe request handler that lets the server terminates specific streams.

This PR is build on top of stefan/axum (#36).

Fixes nimiq/core-rs-albatross#3216

@Eligioo Eligioo requested review from jsdanielh and hrxi January 21, 2025 10:33
@Eligioo Eligioo changed the base branch from master to stefan/axum January 21, 2025 10:38
@Eligioo Eligioo force-pushed the stefan/unsubscribe-stream branch from 1514975 to 52a472e Compare January 21, 2025 10:41
@Eligioo Eligioo changed the title Stefan/unsubscribe stream Unsubscribe streams Jan 21, 2025
@Eligioo Eligioo force-pushed the stefan/unsubscribe-stream branch from 52a472e to f572d6a Compare January 21, 2025 12:02
By adding a specialized unsubsribe request handler that lets the server terminates specifc streams
@Eligioo Eligioo force-pushed the stefan/unsubscribe-stream branch from f572d6a to b592346 Compare January 22, 2025 08:15
Base automatically changed from stefan/axum to master January 22, 2025 22:11
if subscription_ids.is_empty() {
return error_response(request.id, || {
RpcError::invalid_params(Some(
"Empty list of subscription ids is provided".to_owned(),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"Empty list of subscription ids is provided".to_owned(),
"Empty list of subscription ids provided".to_owned(),

Comment on lines +897 to +903
if let Err(e) = forward_notification(notification, &mut tx, &id, &method).await {
// Break the loop when the channel is closed
if let Error::Mpsc(_) = e {
break;
}

log::error!("{}", e);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if let Err(e) = forward_notification(notification, &mut tx, &id, &method).await {
// Break the loop when the channel is closed
if let Error::Mpsc(_) = e {
break;
}
log::error!("{}", e);
if let Err(error) = forward_notification(notification, &mut tx, &id, &method).await {
// Break the loop when the channel is closed
if let Error::Mpsc(_) = error {
break;
}
log::error!(error);

}
}
_ = &mut notify_future => {
// Break the loop when a unsubscribe notification is received
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Break the loop when a unsubscribe notification is received
// Break the loop when an unsubscribe notification is received

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.

Missing Unsubscribe Methods for WebSocket Streams in JSON-RPC
2 participants