From aaf5618f2012ecc404bb082d5ef8f9ad29925be2 Mon Sep 17 00:00:00 2001 From: Chen Wen Date: Thu, 14 Apr 2016 18:22:02 +0800 Subject: [PATCH 1/2] Fix a bug in cordova: Meteor app hosted in Cordova can't connect to cluster services. --- lib/client/api.js | 13 +++++++++++-- package.js | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/client/api.js b/lib/client/api.js index e89d54b..9d8eae5 100644 --- a/lib/client/api.js +++ b/lib/client/api.js @@ -1,3 +1,12 @@ -Cluster.discoverConnection = function(serviceName) { - return DDP.connect("/" + serviceName); +Cluster.discoverConnection = function(serviceName, ddpOptions) { + var url; + + // use Meteor.absoluteUrl() to construct url by default, just for supporting cordova. + if (!ddpOptions || ddpOptions.useAbsoluteUrl) { + url = Meteor.absoluteUrl(serviceName); + } else { + url = "/" + serviceName; + } + + return DDP.connect(url); }; \ No newline at end of file diff --git a/package.js b/package.js index 0ebe993..0009d5a 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ "summary": "Clustering solution for Meteor with load balancing and service discovery.", - "version": "1.6.9", + "version": "1.7.0", "git": "https://github.com/meteorhacks/cluster.git", "name": "meteorhacks:cluster" }); From b1b9c962688898b41e7afa122e991106e8075eb4 Mon Sep 17 00:00:00 2001 From: Chen Wen Date: Fri, 15 Apr 2016 00:55:33 +0800 Subject: [PATCH 2/2] add `mongo` and `random` in testing. Signed-off-by: Chen Wen --- package.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.js b/package.js index 0009d5a..68234e4 100644 --- a/package.js +++ b/package.js @@ -17,6 +17,8 @@ Npm.depends({ Package.onTest(function(api) { configurePackage(api); api.use('tinytest'); + api.use('mongo'); + api.use('random'); api.use('practicalmeteor:sinon@1.10.3_2'); api.addFiles([