pumble Posted June 23, 2016 Report Posted June 23, 2016 Sup Guys,after ive send a offer id its null. before ive updated to v2 it worked. any ideas ? Quote
pumble Posted June 24, 2016 Author Report Posted June 24, 2016 (edited) offer object and the id are provided correctly... for some reason the id of the offer is null. function sendOffer(offer, id){ offer.setMessage("xxx"); offer.send(); var oid = offer.id; updateTrade("send", id, oid); console.log(oid); } function updateTrade(status, id, offerId){ mysqlConnection.query('UPDATE trades SET status = "'+ status +'", offerId = "'+ offerId +'" WHERE id = ' + id, function(err, row, fields) { if(err){ console.log(err); return; } }); console.log("Trade Offer Done"); Edited June 24, 2016 by pumble Quote
pumble Posted June 24, 2016 Author Report Posted June 24, 2016 could it be a problem based on the asynch style of node and the send function takes to long time to set the id ? but why doest this just happen after ive updated to v2 ? Quote
Dr. McKay Posted June 24, 2016 Report Posted June 24, 2016 could it be a problem based on the asynch style of node and the send function takes to long time to set the id ? but why doest this just happen after ive updated to v2 ? Yes, most certainly. You need to wait for the callback of send(). I have no idea why it worked before v2. My guess is that it didn't. The code you just posted would never work. Quote
pumble Posted June 24, 2016 Author Report Posted June 24, 2016 changed it to callback and waitet for the send to finish.works like a charm now Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.