Skip to content

Commit

Permalink
Transport refactoring, now allows to pass any kind of data to request…
Browse files Browse the repository at this point in the history
…/listen
  • Loading branch information
podefr committed Aug 25, 2012
1 parent 0f0145e commit 6235e2e
Show file tree
Hide file tree
Showing 13 changed files with 208 additions and 290 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
build
.DS_Store
material/
couchdb.stderr
couchdb.stdout
olives.sublime-project
olives.sublime-workspace
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,17 @@ endif
cp -rf docs/latest/ docs/$(VERSION)/

$(MAKE) clean-build

git add docs release

git commit -am "released version $(VERSION)"

git push

git tag $(VERSION)

git push --tags

Olives.js: $(SRC)
mkdir -p build
cat LICENSE-MINI $(SRC) > build/$@
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ <h2><a href="symbols/src/src_UI-plugin.js.html">src/UI-plugin.js</a></h2>
</div>
<div class="fineprint" style="clear:both">

Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Fri Jul 27 2012 12:48:06 GMT+0200 (CEST)
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Aug 18 2012 20:17:03 GMT+0200 (CEST)
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/latest/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ <h2><a href="symbols/Transport.html">Transport</a></h2>
</div>
<div class="fineprint" style="clear:both">

Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Fri Jul 27 2012 12:48:06 GMT+0200 (CEST)
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Aug 18 2012 20:17:03 GMT+0200 (CEST)
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/latest/symbols/LocalStore.html
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">

Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Jul 27 2012 12:48:06 GMT+0200 (CEST)
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Sat Aug 18 2012 20:17:02 GMT+0200 (CEST)
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/latest/symbols/ModelPlugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">

Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Jul 27 2012 12:48:06 GMT+0200 (CEST)
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Sat Aug 18 2012 20:17:02 GMT+0200 (CEST)
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/latest/symbols/OObject.html
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">

Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Jul 27 2012 12:48:06 GMT+0200 (CEST)
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Sat Aug 18 2012 20:17:02 GMT+0200 (CEST)
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/latest/symbols/Plugins.html
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">

Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Jul 27 2012 12:48:06 GMT+0200 (CEST)
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Sat Aug 18 2012 20:17:02 GMT+0200 (CEST)
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/latest/symbols/Transport.html
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">

Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Jul 27 2012 12:48:06 GMT+0200 (CEST)
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Sat Aug 18 2012 20:17:03 GMT+0200 (CEST)
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/latest/symbols/_global_.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">

Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Jul 27 2012 12:48:06 GMT+0200 (CEST)
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Sat Aug 18 2012 20:17:02 GMT+0200 (CEST)
</div>
</body>
</html>
32 changes: 16 additions & 16 deletions olives-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 +12,53 @@ exports.handlers = emily.handlers;
exports.config = emily.config;

exports.registerSocketIO = function (io) {

if (isConnected) {
return false;
return false;
} else {

// On connection we'll reference the handlers in socket.io
io.sockets.on("connection", function (socket) {

var connectHandler = function (func, handler) {
// When a handler is called
socket.on(handler, function (reqData) {

// Add socket.io's handshake for session management
reqData.handshake = socket.handshake;

// pass it the requests data
var stop = func(reqData,
var stop = func(reqData.data,
// The function to handle the result
function onEnd(body) {
socket.emit(reqData.__eventId__, body);
},
socket.emit(reqData.eventId, body);
},
// The function to handle chunks for a kept alive socket
function onData(chunk) {
reqData.__keepalive__ && socket.emit(reqData.__eventId__, ""+chunk);
reqData.keepAlive && socket.emit(reqData.eventId, ""+chunk);
});

// If func returned a stop function
if (typeof stop == "function") {
// Subscribe to disconnect-eventId event
socket.on("disconnect-"+reqData.__eventId__, stop);
socket.on("disconnect-"+reqData.eventId, stop);
}

});

};

// for each handler, described in Emily as they can be used from node.js as well
emily.handlers.loop(connectHandler);
// Also connect on new handlers
emily.handlers.watch("added", connectHandler);

});

isConnected = true;
}


};

exports.requirejs = requirejs;
Expand Down
Loading

0 comments on commit 6235e2e

Please sign in to comment.