Socket
Socket
Sign inDemoInstall

real-time-observer

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    real-time-observer

![RealTimeObserver](https://github.com/kingsae1/real-time-observer/blob/main/realtimeobserver.JPG?raw=true)


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
18.9 kB
Created
Weekly downloads
 

Readme

Source

RealTimeObserver

Author : kingsae1004@gmail.com

What is RealTimeObserver?

real-time-observer is a plugin of node module to subscribe lots of databases. but this beta feature is available to use MongoDB

How to use?

At first, Must initailize Observer class with config (currently support only for MongoDB)

const { RTMongoObserver } = require("./index.js");
const observer = new RTMongoObserver({
  SERVER_TYPE: "MONGODB",
  SERVER_URL: "",
  SERVER_ID: "",
  SERVER_PW: "",
  MONGO_DATABASE: "",
  MONGO_COLLECTION: "",
});

And then optionally you can define collection name. If not defined, load the config property (MONGO_COLLECTION)

observer.getCollection("COLLECTION_NAME");

This way is to subscribe observer (MongoDB collection)

// subscribe database
observer.subscribe(observer.getCollection()).then((data) => {
  console.log(data);
});

I recommend unsubscribe after (unmount/disolve/disable ..) case

// Remove Listner
setTimeout(() => {
  observer.unsubscribe(observer.getCollection());
}, 2000);

How to use test?

npm run test

FAQs

Last updated on 25 Aug 2022

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