Giter Club home page Giter Club logo

node-streaming-socketio's Introduction

node-streaming-socketio

Node demo that streams newly created Account records in Salesforce.com to the browser using socket.io. You can run the demo by opening two browsers:

  1. salesforce CRUD demo with Node - Create a new Account record in this app.
  2. node-streaming-socketio demo - New Account record are streamed to this app and display in the browser using socket.io.

Node Module Dependencies

These will be automatically installed when you use the npm installation method below.

  1. express - framework
  2. nforce - REST wrapper for force.com
  3. jade - the view engine
  4. faye - a publish-subscribe messaging system based on the Bayeux protocol.
  5. socket.io - WebSocket protocol for simplify bi-directional communication over HTTP

Setup Remote Access in Salesforce.com

Setup a new Remote Access to get your OAuth tokens. If you are unfamiliar with settng this up, see 4:45 of my Salesforce.com Primer for New Developers. For your callback, simply use: http://localhost:3001/oauth/_callback

Create a PushTopic in Salesforce.com

Create a new PushTopic from the Developer Console in your org with the follow. This will setup the endpoint for faye to listen to:

PushTopic pt = new PushTopic();
pt.apiversion = 24.0;
pt.name = 'AllAccounts'; pt.description = 'All new account records';
pt.query = 'SELECT Id, Name FROM Account';
insert pt;
System.debug('Created new PushTopic: '+ pt.Id);

You can also set up PushTopics using the Workbench.

Running the Application Locally

From the command line type in:

git clone https://github.com/jeffdonthemic/node-streaming-socketio.git

This will clone this repo locally so you simply have to make your config changes and be up and running. Now replace your OAuth tokens and credentials in the config.js file.

cd node-streaming-socketio
npm install # install all of the packages from the package.json file
node app.js # start the server

Update line 9 in views/layout.jade to point to the correct URL.

Point your browser to: http://localhost:3001

node-streaming-socketio's People

Contributors

jeffdonthemic avatar

Watchers

James Cloos avatar sangram kesari ray avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.