Socket
Socket
Sign inDemoInstall

api-poll

Package Overview
Dependencies
7
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    api-poll

Event driven external API poller designed for real-time applications


Version published
Weekly downloads
39
decreased by-4.88%
Maintainers
1
Install size
486 kB
Created
Weekly downloads
 

Readme

Source

API Poller

An event driven external API poller designed for real-time applications.

Documentation is in the JSDocs.

Example

const Poller = require('api-poll')

const endpoint = 'https://cat-fact.herokuapp.com/facts/random?animal=cat&amount=1'
const randomFact = new Poller(endpoint, {
    repeat: 2000, //ms
    variance: {
        min: 200, //ms
        max: 2500 //ms
    },
    // variance: true,
    fetchHeaders: {
        "Origin": "example.com"
    }
})

randomFact
    .start()
    .on('data', data => console.log('got new data: ', data))

setTimeout(randomFact.stop, 20000)

Keywords

FAQs

Last updated on 17 Nov 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc