Comparing version 0.2.0 to 0.3.0
@@ -20,3 +20,3 @@ /* | ||
var socket = io.connect('http://localhost:6565'); | ||
var socket = io.connect('/streamable'); | ||
var streamable = {}; | ||
@@ -29,3 +29,3 @@ | ||
var _reqQueue = []; | ||
var _reqQueue = []; | ||
var notConnected = true; | ||
@@ -71,2 +71,3 @@ | ||
events.onData.apply(null, payload); | ||
} | ||
@@ -79,3 +80,3 @@ }); | ||
}; | ||
} | ||
}; | ||
@@ -87,5 +88,4 @@ | ||
events.onError(errorThrown); | ||
socket.removeAllListeners(data.streamId); | ||
events.onEnd(); | ||
}; | ||
events.onEnd(); | ||
} | ||
}; | ||
@@ -95,3 +95,2 @@ | ||
streamable.get = function(url, options, events) { | ||
if (notConnected) { | ||
@@ -119,5 +118,5 @@ _reqQueue.push([url, options, events]); | ||
end event, at the very end, always. */ | ||
if(!events.onData) { events.onData = function(){} }; | ||
if(!events.onError) { events.onError = function(error){ throw err; } }; | ||
if(!events.onEnd) { events.onEnd = function(){} }; | ||
if(!events.onData) { events.onData = function(){}; }; | ||
if(!events.onError) { events.onError = function(error){ throw err; }; }; | ||
if(!events.onEnd) { events.onEnd = function(){}; }; | ||
@@ -131,3 +130,2 @@ jQuery.ajax({ | ||
.fail(handleFail(events)); | ||
}; | ||
@@ -134,0 +132,0 @@ |
{ | ||
"name" : "streamable", | ||
"version" : "0.2.0", | ||
"version" : "0.3.0", | ||
"description" : "Super simple streaming responses for Connect/Express.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -87,3 +87,3 @@ var randBytes = require('crypto').randomBytes; | ||
if (!io.__streamableInit) { | ||
io.on('connection', function(socket) { | ||
io.of('/streamable').on('connection', function(socket) { | ||
var socketId = socket.id; | ||
@@ -90,0 +90,0 @@ __sockets[socketId] = socket; |
12643
231