Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Thin stream abstraction on top of pubnub
JavaScript
Branch: future
Pull request Compare This branch is 12 commits behind master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
performance-cases
test
.gitignore
.testem.json
LICENCE
README.md
duplex.js
history.js
index.js
package.json
presence.js
publish.js
subscribe.js

README.md

pubnub-stream

Thin stream abstraction on top of pubnub

Example

var pubnub = require("pubnub-stream")({
        publish_key: "pub-key"
        , subscribe_key: "sub-key"
    })
    , publish = pubnub.createWriteStream
    , subscribe = pubnub.createReadStream
    , WriteStream = require("write-stream")

    , subscribed = subscribe(channel)
    , published = publish(channel)

subscribed
    .pipe(WriteStream(function (data) {
        // incoming data from pubnub channel
    }))

published.write({ some: "data" })

Known issues

  • Sometimes you get the same published message multiple times in a subscription.

  • Sometimes a subscription does not give you the message you expect. (i.e. messages get lost permanently)

  • Sometimes a message gets lost in pubnub until you send another one and those two messages come together

  • Almost no sensible error handling

  • packets are not ordered

Installation

npm install pubnub-stream

Contributors

  • Raynos

MIT Licenced

Something went wrong with that request. Please try again.