diff --git a/lib/wsp.js b/lib/wsp.js index 7a3c0975..0e3754b9 100644 --- a/lib/wsp.js +++ b/lib/wsp.js @@ -147,13 +147,14 @@ } tran.get = function(req, cb){ var body = req.body, lex = body['$'], reply = {headers: {'Content-Type': tran.json}}, opt; - gun.get(lex, function(err, node, key, at, ev){ + gun.on('out', {gun: gun, get: lex, req: 1, '#': Gun.on.ask(function(at, ev){ ev.off(); + var graph = at.put; return cb({headers: reply.headers, body: { '#': gun.wsp.msg(), '@': body['#'], - '$': node, - '!': err + '$': graph, + '!': at.err }}); return; if(Gun.obj.empty(node)){ @@ -180,7 +181,7 @@ }([])); */ cb({headers: reply.headers, chunk: node }); // Use this if you don't want streaming chunks feature. - }, opt); + })}); } tran.put = function(req, cb){ //console.log("tran.put", req); @@ -225,4 +226,4 @@ wsp(opt.server); } }); -}({})); \ No newline at end of file +}({}));