diff --git a/examples/http.js b/examples/http.js index 9fabbb68..c1eb7a93 100644 --- a/examples/http.js +++ b/examples/http.js @@ -1,6 +1,6 @@ var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 80; -var Gun = require('gun'); +var Gun = require('../');// require('gun'); var gun = Gun({ file: 'data.json', s3: { diff --git a/lib/wsp.js b/lib/wsp.js index b98d643b..64377d6f 100644 --- a/lib/wsp.js +++ b/lib/wsp.js @@ -22,6 +22,7 @@ if(!ws || !ws.send || !ws._socket || !ws._socket.writable){ return this.off() } if(!msg || (msg.headers && msg.headers['gun-sid'] === ws.sid)){ return } if(msg && msg.headers){ delete msg.headers['ws-rid'] } + // TODO: BUG? ^ What if other peers want to ack? Do they use the ws-rid or a gun declared id? try{ws.send(Gun.text.ify(msg)); }catch(e){} // juuuust in case. }); @@ -143,7 +144,7 @@ // This will give you much more fine-grain control over security, transactions, and what not. var reply = {headers: {'Content-Type': tran.json}}; if(!req.body){ return cb({headers: reply.headers, body: {err: "No body"}}) } - gun.server.on('network').emit(req); + gun.server.on('network').emit(Gun.obj.copy(req)); if(tran.put.key(req, cb)){ return } // some NEW code that should get revised. if(Gun.is.node(req.body) || Gun.is.graph(req.body)){ diff --git a/test/common.js b/test/common.js index 5521fae4..90f31009 100644 --- a/test/common.js +++ b/test/common.js @@ -1886,7 +1886,7 @@ describe('Gun', function(){ describe('Streams', function(){ var gun = Gun(), g = function(){ return Gun({hooks: {get: ctx.get}}); - }, ctx = {gen: 5, extra: 45, network: 2}; + }, ctx = {gen: 9, extra: 45, network: 2}; it('prep hook', function(done){ this.timeout(ctx.gen * ctx.extra);