2.0.3 • Published 8 years ago

vk-streaming v2.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

vk-streaming

Что делает?

Позволяет взаимодействовать с методами Streaming API VK.

Как использовать?

$ npm install vk-streaming
const { getServer, Rules, Read } = require('vk-streaming');

// Получение сервера и ключа
getServer('cc968...c25cc')
  .then(data => data.response)
  .then(console.log);

// Получение, удаление и добавление правил
const rules = new Rules(
  'server',
  'key'
);

rules.get()
  .then(console.log);

rules.delete(1)
  .then(console.log);

rules.add({
    value: 'hello',
    tag: '1'
  })
  .then(console.log);

// Чтение потока
const read = new Read(
  'server',
  'key'
);

read.stream()
  .onmessage = event => console.log(JSON.parse(event.data).event);
// Все события WebSocket см. в его документации
2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

1.0.3

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.1

8 years ago