Setting up the server
To visualize the stock numbers coming from our pubsub
node, we're going to use the real-time charting library Smoothie (http://smoothiecharts.org) and, once again, the XMPP-FTW
skeleton project. Let's begin:
cd ~ git clone git@github.com:xmpp-ftw/skeleton-project.git pubsub-example cd pubsub-example
Before installing all the project dependencies, we're going to change the package.json
file. Open the file and remove the line under dependencies for xmpp-ftw-buddycloud
(since we won't' be using that module in this project). Once saved, we can install the xmpp-ftwpubsub
extension:
npm i . npm i --save xmpp-ftw-pubsub
Next, we'll update the server so that it only responds to pubsub-related events (although in production we'd want to lock it down further to specific events only). In index.js
we're going to clear the default listeners and add our pubsub
extension. Open the project's index.js
file and where the connection event listener is, we'll update the code to read:
primus...