https://github.com/parasyte/async-pubnub-js
Async PubNub Client
https://github.com/parasyte/async-pubnub-js
Last synced: 10 months ago
JSON representation
Async PubNub Client
- Host: GitHub
- URL: https://github.com/parasyte/async-pubnub-js
- Owner: parasyte
- Created: 2022-08-29T04:59:38.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-18T22:11:07.000Z (almost 3 years ago)
- Last Synced: 2025-01-23T04:25:40.970Z (about 1 year ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Async PubNub Client
This is an implementation of the sketch shown in [this gist](https://gist.github.com/parasyte/c0a32db68326df9d1f606f1508136c2c).
The core principle is to eliminate callbacks by taking advantage of `async/await`. Subscribing to a channel creates a unique `Stream`. The `Stream` in turn provides a method to produce messages (`publish()`) and an async iterator interface to consume messages.
This design tightly couples the PubNub "publish/subscribe" duality into a single `Stream` and hides the complexity of message routing within the global listeners.
See [`example.js`](./examples/example.js) for usage.