Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nftx/queue

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nftx/queue

This package is written specifically to allow communication and job running between NFTX-API and NFTX-API-INDEXER

  • 1.10.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-88.1%
Maintainers
2
Weekly downloads
 
Created
Source

@nftx/ queue

This package is written specifically to allow communication and job running between NFTX-API and NFTX-API-INDEXER

Signals and Messages can be sent and received using this library. Signals are used to trigger an intended action whereas Messages are used to notify of events. They act very differently behind the scenes:

A signal is passed to bullmq which then passes it on to a single worker to process. You can have multiple listeners for a signal, but only 1 listener will be given the signal.

Messages, on the other hand, are broadcast to all listeners.

Usage

// Create a listener for the signal
onSignal(async (type, data) => {
  // Dispatch to the network-specific listener
  sendNetworkSignal(data.network, type, data);
});

// Create a listener for mainnet signals
onNetworkSignal(1, (type, data) => {
  switch (type) {
    case 'index-vault':
      // Handle indexing a vault here
      // Broadcast a message when the job is complete
      sendMessage('vault-indexed', {});
      break;
  }
});

// Create multiple listeners for messages
onMessage((type, data) => {
  switch (type) {
    case 'vault-indexed':
      // Do something
      breka;
  }
});

// Emit a signal
sendSignal('index-vault', { vaultId: '0' });

FAQs

Package last updated on 11 Jan 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