Skip to content Skip to sidebar Skip to footer

Pubnub Subscribe Stops Receiving Messages After Some Time

I have some remote devices which communicate with a central Meteor application running on a Digital Ocean Ubuntu 14.04 droplet in a Docker container. Each device has it's own chann

Solution 1:

Running NodeJS in Docker on Digital Ocean

With a PubNub Socket Connection to receive updates on data channels you can setup a node.js app which runs continuously. The following example is runnable from command line when you name your file app.js.

npm install pubnub

node app.js

// app.jsconstPubNub = require('pubnub');
const pubnub = newPubNub({ publishKey : 'demo', subscribeKey : 'demo' });

pubnub.addListener({
    message  : m =>console.log(m) 
,   error    : m =>console.log(m) 
,   presence : m =>console.log(m) 
});

pubnub.subscribe({ channels : ['a'] });

Docker NodeJS on Digital Ocean

Post a Comment for "Pubnub Subscribe Stops Receiving Messages After Some Time"