meteorhacks / zones

Zone.js integration for meteor
MIT License
30 stars 11 forks source link

Directly wrap Connection Class #3

Closed arunoda closed 10 years ago

arunoda commented 10 years ago

Rather than hijacking the Meteor.call directly. Try to hijack Connection.prototype.call.

See: https://github.com/meteor/meteor/blob/devel/packages/livedata/livedata_connection.js#L617

Try that and see how it works.

arunoda commented 10 years ago

Wrap both "subscription" and "apply" (no need call)

thani-sh commented 10 years ago

On it

thani-sh commented 10 years ago

"subscribe" right? https://github.com/meteor/meteor/blob/devel/packages/livedata/livedata_connection.js#L459

arunoda commented 10 years ago

yes yes. Sorry.


Arunoda Susiripala

@arunoda http://twitter.com/arunoda http://gplus.to/arunodahttps://github.com/arunoda http://www.linkedin.com/in/arunoda

On Thu, Jul 10, 2014 at 10:53 AM, Muhammed Thanish <notifications@github.com

wrote:

"subscribe" right?

https://github.com/meteor/meteor/blob/devel/packages/livedata/livedata_connection.js#L459

— Reply to this email directly or view it on GitHub https://github.com/meteorhacks/meteor-zone/issues/3#issuecomment-48566484 .

thani-sh commented 10 years ago

I think we missed this line https://github.com/meteor/meteor/blob/devel/packages/livedata/livedata_connection.js#L27

Connection is not global. I'll see if Its exposed any other way.

thani-sh commented 10 years ago

There's one here https://github.com/meteor/meteor/blob/devel/packages/livedata/livedata_connection.js#L1524

but it says api.export('LivedataTest', {testOnly: true});

arunoda commented 10 years ago

Don't use this. This is JS man. Very hard to hide stuff.

DDP.connect = function (url, options) {
  var ret = new Connection(url, options);
  allConnections.push(ret); // hack. see below.
  return ret;
};

See. Do a fake DDP connect and disconnect immediately. Now you've a connection object. Then get the prototype :)

conn.constructor.prototype
thani-sh commented 10 years ago

Cool

thani-sh commented 10 years ago

I guess we can close this issue

arunoda commented 10 years ago

yep.