Socket
Socket
Sign inDemoInstall

@solana/rpc-subscriptions

Package Overview
Dependencies
Maintainers
0
Versions
747
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/rpc-subscriptions

A library for subscribing to Solana RPC notifications


Version published
Weekly downloads
3.2K
decreased by-7.99%
Maintainers
0
Weekly downloads
 
Created
Source

npm npm-downloads semantic-release
code-style-prettier

@solana/rpc-subscriptions

This package contains types that implement RPC subscriptions as required by the Solana RPC. Additionally, it incorporates some useful defaults that make working with subscriptions easier, more performant, and more reliable. It can be used standalone, but it is also exported as part of the Solana JavaScript SDK @solana/web3.js@rc.

Functions

getChannelPoolingChannelCreator(createChannel, { maxSubscriptionsPerChannel, minChannels })

Given a channel creator, will return a new channel creator with the following behavior.

  1. When called, returns an RpcSubscriptionsChannel. Adds that channel to a pool.
  2. When called again, creates and returns new RpcSubscriptionChannels up to the number specified by minChannels.
  3. When minChannels channels have been created, subsequent calls vend whichever existing channel from the pool has the fewest subscribers, or the next one in rotation in the event of a tie.
  4. Once all channels carry the number of subscribers specified by the number maxSubscriptionsPerChannel, new channels in excess of minChannel will be created, returned, and added to the pool.
  5. A channel will be destroyed once all of its subscribers' abort signals fire.

getRpcSubscriptionsChannelWithJSONSerialization(channel)

Given an RpcSubscriptionsChannel, will return a new channel that parses data published to the 'message' channel as JSON, and JSON-stringifies messages sent via the send(message) method.

getRpcSubscriptionsChannelWithAutoping(channel)

Given an RpcSubscriptionsChannel, will return a new channel that sends a ping message to the inner channel if a message has not been sent or received in the last intervalMs. In web browsers, this implementation sends no ping when the network is down, and sends a ping immediately upon the network coming back up.

Keywords

FAQs

Package last updated on 04 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc