From 82443266b93e8977ee77b55ff1967fa98706b81e Mon Sep 17 00:00:00 2001 From: Sam Hiatt Date: Wed, 22 Apr 2015 16:00:35 -0700 Subject: [PATCH 1/3] ignore .idea --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 40c0619e..c452cc5e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules .jshintrc +.idea Procfile From 40557a088c73d34742abb36956f9ffe026787bf6 Mon Sep 17 00:00:00 2001 From: Sam Hiatt Date: Wed, 22 Apr 2015 17:10:30 -0700 Subject: [PATCH 2/3] Updated to use 'ws' instead of 'websocket-server', which has been unpublished. Also added npm test script. --- lib/cube/server.js | 20 ++------------------ package.json | 5 +++-- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/lib/cube/server.js b/lib/cube/server.js index eabbf400..7991e6cd 100644 --- a/lib/cube/server.js +++ b/lib/cube/server.js @@ -3,13 +3,10 @@ var util = require("util"), http = require("http"), dgram = require("dgram"), websocket = require("websocket"), - websprocket = require("websocket-server"), + WebSocketServer = require("ws").Server, static = require("node-static"), database = require('./database'); -// And then this happened: -websprocket.Connection = require("../../node_modules/websocket-server/lib/ws/connection"); - // Configuration for WebSocket requests. var wsOptions = { maxReceivedFrameSize: 0x10000, @@ -33,7 +30,7 @@ module.exports = function(options) { var server = {}, primary = http.createServer(), - secondary = websprocket.createServer(), + secondary = new WebSocketServer({ server: primary }), file = new static.Server("static"), meta, endpoints = {ws: [], http: []}, @@ -41,19 +38,6 @@ module.exports = function(options) { secondary.server = primary; - // Register primary WebSocket listener with fallback. - primary.on("upgrade", function(request, socket, head) { - if ("sec-websocket-version" in request.headers) { - request = new websocket.request(socket, request, wsOptions); - request.readHandshake(); - connect(request.accept(request.requestedProtocols[0], request.origin), request.httpRequest); - } else if (request.method === "GET" - && /^websocket$/i.test(request.headers.upgrade) - && /^upgrade$/i.test(request.headers.connection)) { - new websprocket.Connection(secondary.manager, secondary.options, request, socket, head); - } - }); - // Register secondary WebSocket listener. secondary.on("connection", function(connection) { connection.socket = connection._socket; diff --git a/package.json b/package.json index 3991731e..774b8a14 100644 --- a/package.json +++ b/package.json @@ -14,13 +14,14 @@ "type": "git", "url": "http://github.com/square/cube.git" }, + "scripts":{"test":"./node_modules/.bin/vows"}, "main": "./lib/cube", "dependencies": { - "mongodb": "~1.3.18", + "mongodb": "^1.4", "node-static": "0.6.5", "pegjs": "0.7.0", "vows": "0.7.0", "websocket": "1.0.8", - "websocket-server": "1.4.04" + "ws": "^0.7.1" } } From 0453cd1e2c79850b9b68ffb58fa520679248a93e Mon Sep 17 00:00:00 2001 From: Sam Hiatt Date: Thu, 23 Apr 2015 13:47:14 -0700 Subject: [PATCH 3/3] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 774b8a14..8ced92fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cube", - "version": "0.2.12", + "version": "0.2.13", "description": "A system for analyzing time series data using MongoDB and Node.", "keywords": [ "time series"