Permalink
Browse files

0.4.0

* add client support for server
  • Loading branch information...
1 parent 4cc2316 commit 64b10d1707279d2a022e2906104bcdc868363de6 @ramitos committed Feb 11, 2013
Showing with 32 additions and 19 deletions.
  1. +0 −1 .npmignore
  2. +1 −1 bower.json
  3. +1 −1 component.json
  4. +1 −1 package.json
  5. +7 −5 src/client/restio.js
  6. +3 −3 src/on.js
  7. +11 −0 src/requires.js
  8. +3 −1 src/server/restio.js
  9. +5 −3 src/setup.js
  10. +0 −3 src/type.js
View
@@ -3,6 +3,5 @@ node_modules
components
build
component.json
-src/client
dist
docs
View
@@ -1,5 +1,5 @@
{
"name": "restio",
- "version": "0.3.2",
+ "version": "0.4.0",
"main": "./dist/restio.js"
}
View
@@ -1,7 +1,7 @@
{
"name": "restio",
"license": "MIT",
- "version": "0.3.2",
+ "version": "0.4.0",
"twitter": "@ramitos",
"description": "REST-like syntax for WebSockets",
"main": "src/client/restio.js",
View
@@ -1,7 +1,7 @@
{
"name": "restio",
"license": "MIT",
- "version": "0.3.2",
+ "version": "0.4.0",
"author": "Sérgio Ramos",
"description": "REST-like syntax for WebSockets",
"main": "src/server/restio.js",
View
@@ -1,17 +1,19 @@
-var methods = require('../methods'),
+var requires = require('../requires'),
+ methods = require('../methods'),
packet = require('../packet'),
setup = require('../setup'),
mr = require('match-route'),
- eio = require('engine.io'),
- getOn = require('../on'),
- ev = require('emitter');
+ getOn = require('../on');
+
+var eio = requires.eio;
+var ev = requires.ev;
module.exports.connect = function (addr, callback) {
var socket = new eio.Socket(addr);
var callbacks = {};
var io = new ev();
var routes = {};
-
+
methods.forEach(function (method) {
setup.methods(method, callbacks, routes);
setup.request(method, io, socket, callbacks);
View
@@ -1,7 +1,7 @@
-var platform = require('./platform'),
+var type = require('./requires').type,
+ platform = require('./platform'),
packet = require('./packet'),
- mr = require('match-route'),
- type = require('./type');
+ mr = require('match-route')
module.exports = function (socket, callbacks, routes) {
var on = {};
View
@@ -0,0 +1,11 @@
+var platform = require('./platform');
+
+if(platform == 'browser') {
+ module.exports.eio = require('engine.io');
+ module.exports.ev = require('emitter');
+ module.exports.type = require('type');
+} else {
+ module.exports.ev = require('events').EventEmitter;
+ module.exports.eio = require('engine.io-client');
+ module.exports.type = require('type-component');
+}
View
@@ -1,9 +1,11 @@
-var ev = require('events').EventEmitter,
+var ev = require('../requires').ev,
methods = require('../methods'),
setup = require('../setup'),
cookie = require('cookie'),
getOn = require('../on');
+module.exports.client = require('../client/restio');
+
module.exports.listen = function () {
var server = setup.server(Array.prototype.slice.call(arguments).shift());
var callbacks = {};
View
@@ -1,11 +1,13 @@
-var methods = require('./methods'),
- engine = require('engine.io'),
+var requires = require('../requires'),
+ methods = require('./methods'),
packet = require('./packet'),
assert = require('assert'),
- type = require('./type'),
sgen = require('sgen'),
noop = function () {};
+var engine = requires.eio
+var type = requires.type
+
module.exports.methods = function (method, callbacks, routes) {
callbacks[method] = {};
routes[method] = {};
View
@@ -1,3 +0,0 @@
-var platform = require('./platform');
-
-module.exports = platform == 'browser' ? require('type') : require('type-component');

0 comments on commit 64b10d1

Please sign in to comment.