1.0.0 • Published 1 year ago

@iam4x/treenews v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

TreeNews

An universal JavaScript client of TreeNews WebSocket

Written in TypeScript with definitions typings

Installation

  • $ npm install --save @iam4x/treenews

If you are working in a node.js/server environment, you need to install ws package as well:

  • $ npm install --save ws

How to / Usage

Simple example:

import { TreeNews } from '@iam4x/treenews';

const treeNews = new TreeNews({
  onNews: (news) => console.log(JSON.stringify(news, null, 4));
});

// connect to websocket
treeNews.start();

// close connection to websocket
treeNews.stop();

Options

{
  autoReconnect?: boolean; // default: true
  autoReconnectTimeout?: number; // default: to 1 second (in seconds)
  autoStart?: boolean;
  apiKey?: string;
  debug?: boolean;
  onOpen?: (event: Event) => void;
  onError?: (event: Event) => void;
  onNews?: (news: News) => void;
  onMessage?: (event: MessageEvent) => void;
  onClose?: (event: CloseEvent) => void;
}

Donations

If you found this project interesting or useful, create accounts with my referral links:

Or buy me a coffee with a crypto donation:

  • ETH/BSC/MATIC: 0xFF2da578C73bC694fd767A1CC77160002C2003E6

Changelog

v1.0.0 - (03/29/2023)

  • Initial release

Contributions & Pull Requests

Feel free to create issues, PRs and start a discussion ❤️

1.0.0

1 year ago