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

telepat-worker

v0.4.4

Published

Telepat Workers are responsible for processing requests coming from the API and sending notifications to clients

Downloads

8

Readme

Telepat Workers

There are 4 main types of workers:

  • Aggregators: writes deltas (deltas are a representation of an individual operations on the database) in the database. These workers then send messages to writers notifying them that they have work to do. This worker consumes messages from the aggregator topic.
  • Writers: reads deltas and processes them (CRUD operations). They then send messages to transport manager workers with the processed deltas. This worker consumes messages from the write topic.
  • Transport managers: gets all devices in the affected subscriptions from the deltas. Then it sorts them according to the transport type each device uses and sends messages to the corresponding workers. This worker consumes messages from the transport_manager topic.

Then there are the client transport type workers. These type of workers are in charge of communicating with the client. They send messages containing changes to the database objects. Right now there are 3 transport workers: for Android (using gcm), iOS (APN) and sockets for other clients. These workers send messages only to clients that are subscribed to the channel (writers include these in the messages sent by them to transport workers).

  • android_transport, the topic from where the android transport worker consumes messages
  • ios_transport, the topic from where the ios transport worker consumes messages
  • sockets_transport, the topic from where the sockets transport worker consumes messages

Quick start up guide

node index.js -t <topic name> -i <worker index>

  • topic name is the name of the kafka topic (the type of worker): aggregation, write, track, etc.
  • worker index this is necessary because you can start multiple workers on the same topic

IMPORTANT: worker index is needed for volatile transports (server based, like sockets_transport), that's because these have their own message queue to consume from

Configuring

There are two ways to configure: either by using the config.example.json config file (rename it into config.json) or by setting up environment variables (this method is the most convenient):

  • TP_MSG_QUE: Name of the messaging client you want to use. Should be the same as the exported variable in telepat-models
  • TP_MAIN_DB: Name of the main database which to use. Should be the same as the exported variable in telepat-models
  • TP_SCKT_PORT: Sockets transport worker listening port (defaults for 80 and 443 for SSL)
  • TP_SCKT_SSL: Wether to use SSL or not
  • TP_SCKT_KEY_SSL: Path to a file that contains a private key (SSL only)
  • TP_SCKT_CERT_FILE: Path to a file that contains a certificate (SSL only)
  • TP_SCKT_KEY_PASSPHRASE: Passphrase of the private key (SSL only)
  • TP_SCKT_CA_CERT: Path to a file that contains an intermediate certificate (SSL only)

Important: You need to set up the other config variables specified in the telepat-models README file for resources that you're using.