1.2.0 • Published 4 years ago

real-time-query v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

A real-time query library that can be easily integrated into the UI framework.

Installation

npm install real-time-query

Usage

import RealTimeQuery, { rxjsOperators } from 'real-time-query';

// Create an instance.
const realTimeQuery = new RealTimeQuery({
  url: 'ws://localhost:3000'
});

// RxJS operators. https://www.learnrxjs.io/learn-rxjs/operators
// Optional.
const { timestamp } = rxjsOperators;
realTimeQuery.pipe([
  timestamp(),
]);

// Start getting data.
realTimeQuery.subscribe(
  result => {
    // The data you need.
    console.log('result:', result)
  }
);

// Close connection when cleaning up
realTimeQuery.close();

Examples

react

License

MIT

1.2.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago