Permalink
Browse files

updated 2014, libraries

  • Loading branch information...
1 parent b62296c commit 4b9bec96256ce4aa33d139e86a74ab907717409b @chrisckchang chrisckchang committed Sep 5, 2014
Showing with 12 additions and 42 deletions.
  1. +0 −3 .gitignore
  2. +4 −16 app.js
  3. +0 −16 config.js
  4. +3 −3 index.html
  5. +5 −4 package.json
View
3 .gitignore
@@ -1,3 +0,0 @@
-.DS_Store
-node_modules
-
View
20 app.js
@@ -11,7 +11,7 @@
// ObjectLabs is the maker of MongoLab.com a cloud, hosted MongoDb
// service
-// Copyright 2012 ObjectLabs Corp.
+// Copyright 2014 ObjectLabs Corp.
// MIT License, except intervalEach()
@@ -66,13 +66,10 @@ emitter = require("events").EventEmitter,
assert = require("assert"),
mongo = require("mongodb"),
-config = require("./config").config,
-QueryCommand = mongo.QueryCommand,
-Cursor = mongo.Cursor,
-Collection = mongo.Collection;
+Cursor = mongo.Cursor;
// Heroku-style environment variables
-var uristring = process.env.MONGOLAB_URI || "mongodb://localhost/testdatabase"
+var uristring = process.env.MONGOLAB_URI || "mongodb://localhost/testdatabase";
var mongoUrl = url.parse (uristring);
//
@@ -101,7 +98,7 @@ function handler (req, res) {
// Open mongo database connection
// A capped collection is needed to use tailable cursors
//
-mongo.Db.connect (uristring, function (err, db) {
+mongo.MongoClient.connect (uristring, function (err, db) {
console.log ("Attempting connection to " + mongoUrl.protocol + "//" + mongoUrl.hostname + " (complete URL supressed).");
db.collection ("messages", function (err, collection) {
collection.isCapped(function (err, capped) {
@@ -125,15 +122,6 @@ mongo.Db.connect (uristring, function (err, db) {
function startIOServer (collection) {
console.log("Starting ...");
- // Many hosted environments do not support all transport forms currently, (specifically WebSockets).
- // So we force a relatively safe xhr-polling transport.
- // Modify io.configure call to allow other transports.
-
- io.configure(function () {
- io.set("transports", config[platform].transports); // Set config in ./config.js
- io.set("polling duration", 10);
- io.set("log level", 2);
- });
io.sockets.on("connection", function (socket) {
readAndSend(socket, collection);
});
View
16 config.js
@@ -1,16 +0,0 @@
-platform = process.env.PLATFORM ? process.env.PLATFORM : 'safe'
-
-config = {
- // Platform capabilities
- safe : {
- transports : ["xhr-polling"]
- },
- heroku : {
- transports : ["xhr-polling"]
- },
- joyent : {
- transports : ["websocket", "xhr-polling"]
- }
-}
-
-exports.config = config
View
6 index.html
@@ -1,7 +1,7 @@
<!doctype html>
<!--
- Copyright 2012 ObjectLabs Corp.
+ Copyright 2014 ObjectLabs Corp.
MIT License
@@ -154,9 +154,9 @@
-<p> Original Demo: 2012 March. Updated 2013 March.
+<p> Original Demo: 2012 March. Updated 2013 March. Updated 2014 September.
<p>
- Copyright 2012, 2013 ObjectLabs Corp.
+ Copyright 2012, 2013, 2014 ObjectLabs Corp.
<p> MIT License
View
9 package.json
@@ -2,12 +2,13 @@
"name": "TractorPush",
"description" : "A Node.js, socket.io, and MongoDB tailed cursor push demo.",
"dependencies": {
- "mongodb": "1.2.13",
- "socket.io" : "0.9.13" },
+ "mongodb": "1.4.10",
+ "socket.io" : "1.1.0" },
"engines" : {
- "node" : "0.8.11"},
+ "node" : "0.10.31",
+ "npm" : "1.4.25" },
"keywords" : ["mongodb", "mongo", "mongolab", "node.js", "node", "socket.io", "WebSockets"],
- "version": "0.9.1",
+ "version": "0.10.1",
"author" : "Ben Wen",
"contributors" : {"mongodb - node.js driver" : "Christian Amor Kvalheim <christkv@gmail.com>, et. al.",
"numerous valuable additions" : "Ryan Daigle, Heroku"}

0 comments on commit 4b9bec9

Please sign in to comment.