Update:
Apparently you don’t. (Create a structure to receive the responses)
Here’s a snippet of the code that sends some data to the robot:
gopigo3_orientation.state = 'move';
gopigo3_orientation.angle_degrees = data.angle.degree;
if('direction' in data) {
gopigo3_orientation.angle_dir = data.direction.angle;
}
gopigo3_orientation.force = data.force;
query_string = '?' + $.param(gopigo3_orientation);
// use the following function instead the usual $.post
// so that we can throttle the rate of sending data
// good practice for not "choking" the network
send_throttled_data(server_address, query_string, gopigo3_orientation);
Here’s a snippet of the code that receives the data from the browser:
@app.route("/robot", methods = ["POST"])
def robot_commands():
# get the query
args = request.args
state = args['state']
angle_degrees = int(float(args['angle_degrees']))
angle_dir = args['angle_dir']
force = float(args['force'])
If I’m reading that correctly, (and my money’s on “I’m not” ), the entire structure is sent as name:value pairs where “force” references/contains the value for the force sent - and you can reference an argument more than once to re-read it’s value.
I am going to have to experiment with this.