@vk-io/streaming
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

VK-IO Streaming

NPM version Build Status NPM downloads

VK-IO Streaming API - Separated module for receiving data with Streaming API ⚙️

📦 Installation

Node.js 12.20.0 or newer is required

  • Using npm (recommended)
    npm i @vk-io/streaming
  • Using Yarn
    yarn add @vk-io/streaming
  • Using pnpm
    pnpm add @vk-io/streaming

Example usage

import { VK } from 'vk-io';

import { StreamingAPI } from '@vk-io/streaming';

const vk = new VK({
	token: process.env.TOKEN
});

const streaming = new StreamingAPI({
	api: vk.api,
	updates: vk.updates
});

vk.updates.on('publication', (context) => {
	console.log('Streaming context', context);
});

async function run() {
	await streaming.startWebSocket();

	await streaming.addRule({
		tag: 'halloween',
		value: 'тыква'
	});
}

run().catch(console.error);

Readme

Keywords

Package Sidebar

Install

npm i @vk-io/streaming

Weekly Downloads

2

Version

1.2.1

License

MIT

Unpacked Size

30.3 kB

Total Files

12

Last publish

Collaborators

  • negezor