python-ddp icon indicating copy to clipboard operation
python-ddp copied to clipboard

calling method on meteor

Open ofqwx opened this issue 8 years ago • 1 comments

Hi, I'm trying to use the function call with no success, I'm doing exactly like the docs with no errors but the meteor method no called. I'm using meteor 1.4 and python 2.7. Thanks.

ofqwx avatar Oct 19 '16 22:10 ofqwx

Hi @ofqwx , at minimum you should be able to connect to your meteor method by doing something like the following, where 127.0.0.1 is localhost, and 3000 is the port you are running your app on.

Using PYTHON 3

Setup and Connect Using DDP

client = DDPClient('ws://127.0.0.1:3000/websocket') client.connect() client.call('nameOfMeteorMethodHere', [paramToSend1,paramToSend2]) client.close()

METEOR METHOD:

Meteor.methods({ nameOfMeteorMethodHere: function(param1,param2){ //To debug, log your params... console.log('called nameOfMeteorMethodHere'); console.log(param1); console.log(param2); //Do Something with the params... CollectionName.update({_id: param1}, {$set: {param2: param2}}); } });

mvgalle avatar Apr 19 '17 15:04 mvgalle