Call frontend methods from external meteor application -


i making dockerized services-based application. of services written in meteor, won't.

one of services registration service, users can register platform.

when doing microservices, following:

var myservice = ddp.connect(service_url); var myotherservice = ddp.connect(other_service_url); var registrationservice = ddp.connect(registration_service_url); 

what want use loginwithfacebook method. issue using meteor.loginwithfacebook on frontend invoke backend methods on main frontend server.

however, want invoke backend methods on registrationservice server (which has relevant packages). reason because using accounts.oncreateuser hook stuff, , because want keep registration service separate frontend.

just clarity, though not correct, imagine have this:

'click #facebook-login': function() {   meteor.loginwithfacebook(data, callback) } 

however, want loginwithfacebook method use server-side methods registrationservice when calling client-side method .loginwithfacebook, want effect of following:

'click #facebook-login': function() {   registrationservice.loginwithfacebook(data, callback) } 

any on appreciated. thank you!

i believe looking ddp.connect. underneath meteor calls server client , communication server client use distributed data protocol. (https://www.meteor.com/ddp) documentation points out default client opens ddp connection server loaded from. however, in case, you'd want use ddp.connect connect other servers various different tasks, such registration services server registrationservice. (http://docs.meteor.com/#/full/ddp_connect) simplified example you'll looking this:

if (meteor.isclient) {     var registrationservices = ddp.connect("http://your.registrationservices.com:3000");      template.registersomething.events({         'click #facebook-login': function(){             registrationservices.call('loginwithfacebook', data, function(error, results){ ... }); // registration services points different service default.         }     }); } 

don't forget can have various ddp.connect's various microservices. these akin web service connections in other applications.


Comments