{"action":"created","issue":{"url":"https://api.github.com/repos/meteor/meteor/issues/3852","labels_url":"https://api.github.com/repos/meteor/meteor/issues/3852/labels{/name}","comments_url":"https://api.github.com/repos/meteor/meteor/issues/3852/comments","events_url":"https://api.github.com/repos/meteor/meteor/issues/3852/events","html_url":"https://github.com/meteor/meteor/issues/3852","id":59544802,"number":3852,"title":"How can DDP_DEFAULT_CONNECTION_URL be set","user":{"login":"jamgold","id":599219,"avatar_url":"https://avatars.githubusercontent.com/u/599219?v=3","gravatar_id":"","url":"https://api.github.com/users/jamgold","html_url":"https://github.com/jamgold","followers_url":"https://api.github.com/users/jamgold/followers","following_url":"https://api.github.com/users/jamgold/following{/other_user}","gists_url":"https://api.github.com/users/jamgold/gists{/gist_id}","starred_url":"https://api.github.com/users/jamgold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamgold/subscriptions","organizations_url":"https://api.github.com/users/jamgold/orgs","repos_url":"https://api.github.com/users/jamgold/repos","events_url":"https://api.github.com/users/jamgold/events{/privacy}","received_events_url":"https://api.github.com/users/jamgold/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/meteor/meteor/labels/Project:Mobile","name":"Project:Mobile","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2015-03-02T20:32:45Z","updated_at":"2015-03-19T21:39:06Z","closed_at":null,"body":"I am trying to create a client app that connects to an existing Meteor application to solve the problem with different assets for desktop and mobile. My initial attempt was something like the following function being called before I make any subscriptions on the client. It completely integrates with the remote Meteor site, users and all, and works\r\n```\r\n  Meteor.setConnection = function(url) {\r\n    //\r\n    //\r\n    // Accounts._enableAutoLogin();\r\n    this.connection = DDP.connect(url);\r\n    Accounts.connection = this.connection;\r\n    //\r\n    // this is copied from https://github.com/meteor/meteor/blob/devel/packages/ddp/client_convenience.js#L52-L56\r\n    // it makes sure all method calls are done with the correct connection\r\n    //\r\n    _.each(['subscribe', 'methods', 'call', 'apply', 'status', 'reconnect',                                         // 52\r\n            'disconnect'],                                                                                          // 53\r\n           function (name) {                                                                                        // 54\r\n             Meteor[name] = _.bind(Meteor.connection[name], Meteor.connection);                                     // 55\r\n           });                                                                                                      // 56\r\n    //\r\n    // we need re-declare the users collection so Meteor knows to use the remote one\r\n    //\r\n    this.users = new Meteor.Collection('users');\r\n    //\r\n    // now that we have our act together, try to re-login\r\n    // unfortunately Accounts seems to have already run before\r\n    // we did the Meteor.connection = DDP.connect part, so we manually\r\n    // need to re-check the loginToken or hot code pushes log us out every time\r\n    //\r\n    var token = Accounts._storedLoginToken();\r\n    if(token)\r\n    {\r\n      this.loginWithToken(token, function(err){\r\n        // this is going to throw error if we logged out\r\n        if(err) console.log(err);else console.log('loginWithToken');\r\n      });\r\n    }\r\n  }\r\n```\r\nAfter looking through the source some more, it seems the best way to accomplish this would be if the server sent the bootstrap code to the client containing \r\n\r\n    __meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL\r\n\r\nwhich is being checked in https://github.com/meteor/meteor/blob/devel/packages/ddp/client_convenience.js#L25\r\n\r\nBut when I try to start the server with this env variable set to the desired value, the client bootstrap goes into an infinite loop.\r\n\r\nIs this not intended (I think that is how Cordova works), or a bug?\r\n"},"comment":{"url":"https://api.github.com/repos/meteor/meteor/issues/comments/83769374","html_url":"https://github.com/meteor/meteor/issues/3852#issuecomment-83769374","issue_url":"https://api.github.com/repos/meteor/meteor/issues/3852","id":83769374,"user":{"login":"jamgold","id":599219,"avatar_url":"https://avatars.githubusercontent.com/u/599219?v=3","gravatar_id":"","url":"https://api.github.com/users/jamgold","html_url":"https://github.com/jamgold","followers_url":"https://api.github.com/users/jamgold/followers","following_url":"https://api.github.com/users/jamgold/following{/other_user}","gists_url":"https://api.github.com/users/jamgold/gists{/gist_id}","starred_url":"https://api.github.com/users/jamgold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamgold/subscriptions","organizations_url":"https://api.github.com/users/jamgold/orgs","repos_url":"https://api.github.com/users/jamgold/repos","events_url":"https://api.github.com/users/jamgold/events{/privacy}","received_events_url":"https://api.github.com/users/jamgold/received_events","type":"User","site_admin":false},"created_at":"2015-03-19T21:39:06Z","updated_at":"2015-03-19T21:39:06Z","body":"@gwendall since this is the verbatim code I posted, I can tell you from experience it does not work with Cordova"}}