0.0.5 • Published 4 years ago

pubsub-ddp-client v0.0.5

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

pubsub-ddp-client

Do not use this library yet. Its work in progress. Even the name will likely change

A modern isomorphic DDP client for easy pub/sub integration on the site.

This client features

  • Serverside Rendering
  • Promise and async/await based methods
  • An event emitter to listen for incoming messages

Usage

npm i pubsub-ddp-client

or

yarn pubsub-ddp-client

On either the server or browser:

import DDPClient from 'pubsub-ddp-client';

const URL = 'ws://localhost:3001/websocket';

(async () => {
  const client = new DDPClient(URL)

  await client.connect()

  const items = []

  client.on('items.added', (payload) => items.push(payload))

  await client.subscribe('items')

  console.log(items)
})()
0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago