Hello,
I have been trying a couple of things but still I cannot solve this problem.
I am developing quite a simple Application, which shall include sending data via HTTP requests.
There is one request to receive data and one to send. I can see that there is a connection but it sends empty files.
What do I need to do to send the heart rate with the HTTP-Post?
The code I use is the following
function onSend(responseCode, stream) { Sys.println("OnSend " + stream); stream = model.getHeartRate(); //check if request was successful if (responseCode == 200) { Sys.println("Sending Successful"); } else { Sys.println("Response Send: " + responseCode); } Ui.requestUpdate(); } function sendData() { var url = www.placeholder.com //I am testing with a local IP var params = stream; // define the HTTP methods and response type var options = { :method => Communications.HTTP_REQUEST_METHOD_POST, // set HTTP method :headers => {"Content-Type" => Communications.REQUEST_CONTENT_TYPE_JSON}, :responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON // set response type }; // set responseCallback var responseCallback = method(:onSend); // make the Communications.makeWebRequest() call to send data Communications.makeWebRequest(url, params, options, method(:onSend)); }
Thank you in advance for your help.