Comparing version 0.5.0 to 0.6.0
var DDPClient, ddpclient; | ||
DDPClient = require("../index.js"); | ||
DDPClient = require("../index.js"); // Change this to require("ddpclient"); | ||
@@ -5,0 +5,0 @@ ddpclient = new DDPClient("localhost", 3000); |
@@ -69,14 +69,20 @@ var DDPClient, EventEmitter, WebSocket, | ||
if (object.msg === "connected") this.emit("connect", object); | ||
if (object.msg === "data") this.emit("msg-data", object); | ||
if (object.msg === "data") { | ||
this.emit("msg-data", object); | ||
this.emit("msg-data-" + this.identifiers[object.id], object); | ||
} | ||
if (object.msg === "result") { | ||
this.emit("msg-result", object); | ||
return this.emit("msg-result-" + this.identifiers[object.id], object); | ||
this.emit("msg-result-" + this.identifiers[object.id], object); | ||
} | ||
if (object.msg === "nosub") this.emit("msg-nosub", object); | ||
if (object.msg === "error") return this.emit("msg-error", object); | ||
}; | ||
DDPClient.prototype.call = function(identifier, name, params) { | ||
DDPClient.prototype.call = function(identifier, method, params) { | ||
var id; | ||
if (name instanceof Array) { | ||
params = name; | ||
name = identifier; | ||
if (method === void 0) method = identifier; | ||
if (method instanceof Array) { | ||
params = method; | ||
method = identifier; | ||
} | ||
@@ -86,5 +92,5 @@ id = this.register_identifier(identifier); | ||
"msg": "method", | ||
"method": name, | ||
"params": params, | ||
"id": id | ||
"id": id, | ||
"method": method, | ||
"params": params | ||
}); | ||
@@ -95,2 +101,3 @@ }; | ||
var id; | ||
if (name === void 0) name = identifier; | ||
if (name instanceof Array) { | ||
@@ -103,5 +110,5 @@ params = name; | ||
"msg": "sub", | ||
"id": id, | ||
"name": name, | ||
"params": params, | ||
"id": id | ||
"params": params | ||
}); | ||
@@ -108,0 +115,0 @@ }; |
{ | ||
"name": "ddpclient", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Node.js module to connect to servers using DDP protocol.", | ||
"preferGlobal": "false", | ||
"main": "index.js", | ||
@@ -7,0 +6,0 @@ "author": "Alan Sikora", |
@@ -1,11 +0,15 @@ | ||
ddpclient | ||
========= | ||
Node.js DDP Client v0.6 | ||
======================= | ||
Node.js module to connect to servers using DDP protocol. | ||
development | ||
=========== | ||
This was based on the existing Python client: https://github.com/meteor/meteor/tree/master/examples/unfinished/python-ddp-client | ||
Use: "coffee --bare -wc -j lib/*.js src/*.coffee" | ||
installation | ||
============ | ||
``` | ||
npm install ddpclient | ||
``` | ||
example | ||
@@ -16,2 +20,7 @@ ======= | ||
development | ||
=========== | ||
Use: "coffee --bare -wc -j lib/*.js src/*.coffee" | ||
TODO | ||
@@ -18,0 +27,0 @@ ==== |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8203
121
28