I'm hosting a webpage on my server via Apache. From there i'm using jquery.ajax() to request data.
function get_trials() {
$.ajax(
{method:"POST",
url:"https://annotatie01.io.tudelft.nl:80/get_trial",
success: function(response) {
data = response;
data_holder = data;
trials = {};
for(count=0;count < data_holder['trials'].length;count++)
{trials[count] = {'meta':{}};
trials[count]['meta'] = {'url':data_holder['trials'][count][0]};}
}
})
}
On the server side i have Flask running.
@app.route('/send_data',methods=['POST'])
def send_data(): # is actually receiving data here
data = request.json['data']
print(data)
write_data_to_database(data)
return jsonify(reply = 'Ok')
My code appears to be working properly most of the time. Yet, every now and then, for reasons I've not been able to pin-point my server returns ERR_TIMED_OUT. When it does, it'll keep doing so consistently for a while, after which it'll 'work' again. It seems to be somewhat related to using get_trials() from different machines, as it appears to be more likely to return a time-out when calling from different machines. Yet, this is also not consistent, since at other times i can successfully call it from 3 different machines.
When it returns the time-out, the post request is never received by the server.
How can i trace and solve this error?