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

feat: add listener callback to socket-io client subscription functions #1799

Merged
merged 6 commits into from
Jan 5, 2024

Conversation

zone117x
Copy link
Member

@zone117x zone117x commented Jan 5, 2024

  • Add optional callback arg to all socket-io client subscribe functions
  • Fix some inconsistencies in socket-io event names

Example usage to subscribe to a tx:

import { StacksApiSocketClient } from '@stacks/blockchain-api-client';

const client = new StacksApiSocketClient({
  url: 'https://api.mainnet.hiro.so'
});

const sub = client.subscribeTransaction(myTxId, tx => {
  console.log('update for tx:', tx.tx_id);
  console.log('tx status:', tx.tx_status);
});

// Cleanup later on..
sub.unsubscribe();

@github-actions github-actions bot temporarily deployed to commit January 5, 2024 11:57 Inactive
Copy link

github-actions bot commented Jan 5, 2024

@github-actions github-actions bot temporarily deployed to pull request January 5, 2024 11:57 Inactive
Copy link

github-actions bot commented Jan 5, 2024

Vercel deployment URL: https://stacks-blockchain-2vsayzr02-blockstack.vercel.app 🚀

Copy link

codecov bot commented Jan 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (20097fc) 76.82% compared to head (927d65a) 76.33%.
Report is 35 commits behind head on beta.

Additional details and impacted files
@@            Coverage Diff             @@
##             beta    #1799      +/-   ##
==========================================
- Coverage   76.82%   76.33%   -0.50%     
==========================================
  Files          80       79       -1     
  Lines       11515    11040     -475     
  Branches     2575     2470     -105     
==========================================
- Hits         8846     8427     -419     
+ Misses       2540     2487      -53     
+ Partials      129      126       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions github-actions bot temporarily deployed to pull request January 5, 2024 12:04 Inactive
@github-actions github-actions bot temporarily deployed to commit January 5, 2024 12:05 Inactive
@github-actions github-actions bot temporarily deployed to commit January 5, 2024 12:54 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 5, 2024 12:55 Inactive
@zone117x zone117x requested a review from rafaelcr January 5, 2024 12:58
@github-actions github-actions bot temporarily deployed to commit January 5, 2024 13:14 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 5, 2024 13:14 Inactive
@github-actions github-actions bot temporarily deployed to commit January 5, 2024 14:25 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 5, 2024 14:25 Inactive
Copy link
Collaborator

@rafaelcr rafaelcr left a comment

Choose a reason for hiding this comment

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

LGTM

@zone117x zone117x merged commit 5634522 into beta Jan 5, 2024
33 checks passed
@zone117x zone117x deleted the feat/socket-io-listener-cb branch January 5, 2024 15:41
blockstack-devops pushed a commit that referenced this pull request Jan 5, 2024
## [7.5.0-beta.1](v7.4.0...v7.5.0-beta.1) (2024-01-05)

### Features

* add listener callback to socket-io client subscription functions ([#1799](#1799)) ([5634522](5634522))
@blockstack-devops
Copy link

🎉 This PR is included in version 7.5.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

blockstack-devops pushed a commit that referenced this pull request Jan 5, 2024
## [7.5.0](v7.4.0...v7.5.0) (2024-01-05)

### Features

* add listener callback to socket-io client subscription functions ([#1799](#1799)) ([5634522](5634522))

### Bug Fixes

* socket-io client should not disconnect with no event reply ([#1800](#1800)) ([d596fd5](d596fd5))
@blockstack-devops
Copy link

🎉 This PR is included in version 7.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants