Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (41 sloc) 1.21 KB


Thin stream abstraction on top of pubnub

browser support


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)

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

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

Api surface

  • publish
  • subscribe
  • duplex

Work in progress

  • history
  • presence

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


npm install pubnub-stream


  • Raynos

MIT Licenced

Something went wrong with that request. Please try again.