npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

twitter-gateway

v0.1.5

Published

A gateway that post tweets, published to the Apache Kafka-based Test-bed, to twitter.

Downloads

18

Readme

Twitter-gateway

Gateway service to post tweets, published to the Kafka-based DRIVER+ Test-bed, to twitter.

Twitter Credentials and Privacy

You will need valid Twitter developer credentials in the form of a set of consumer and access tokens/keys. You can get these here. Do not forgot to adjust your permissions - most POST request require write permissions. Next, update your privacy settings, so not everyone will be able to follow your tweets.

Installation

To install it globally, run npm i -g twitter-gateway.

Usage

Run twitter-gateway to start listening to the $CONSUME_TOPIC topic. Each received message is posted to Twitter. Please note that, in case you are including multiple media files, only the first is uploaded and sent. In case you have just started the DRIVER+ Test-bed, initialize it using twitter-gateway -s --test, so you upload the basic schemas as well as publish a test message to the CONSUME topic.

Also the following values are extracted from the environment (specified using SET):

  • $KAFKA
  • $SCHEMA
  • $CONSUMER_KEY
  • $CONSUMER_SECRET
  • $ACCESS_KEY
  • $ACCESS_SECRET.

For example, on Windows, create a file env.bat and run it once before calling the application:

@ECHO OFF
REM Set the environment variables for testing.
REM You can use `echo %KAFKA%` to inspect them, or use `set` to list them all.
SET KAFKA=localhost:3501
SET SCHEMA=localhost:3502
SET CONSUME_TOPIC=simulation_entity_post
SET CONSUMER_KEY=YOUR_KEY
SET CONSUMER_SECRET=YOUR_CONSUMER_SECRET
SET ACCESS_TOKEN=YOUR_ACCESS_TOKEN
SET ACCESS_SECRET=YOUR_ACCESS_SECRET

Alternatively, you can specify them via the command line. Run twitter-gateway -h to see an overview.

Build instructions

npm run build to build to the ./dist folder.

Application structure

NOTE

When using this gateway service, you may encounter several errors:

  1. The schemas are not found: This typically happens when you start the test-bed for the first time, and it hasn't been properly initialized (for example, using the admin tool), and no schema's have been uploaded. Use twitter-gateway -s --test to publish the schemas. This assumes that you have a local folder named schemas that contains the schemas (it will recursively visit all folders).
  2. The topic does not exist: Send out a test-message to create the topic using twitter-gateway --test. These messages are still not published to Twitter though. You have to start it using twitter-gateway.
  3. You get authentication errors: Did you supply all the required settings, either via the environment or via the command line (see above).