10-31-2022, 05:03 PM
Hello,
I am playing with the network connection and trying to send data to a web page using a custom phyphox experiment. If I understand correctly the wiki (https://phyphox.org/wiki/index.php/Network_Connections), there are only two ways to trigger such a connection:
- using the "interval" property of the <connection> block
- using the "trigger" property of a view button
I would like to send a data only once, after a given amount of time, and I would like to avoid using a button. The way I do it now is that I set the interval property at the proper time:
<connection interval="4.6" address="ADDRESS" id="submit" service="http/post" conversion="json" privacy="https://phyphox.org/disclaimer/" autoConnect="true">
<send id="frequency" type="buffer" init="0">frequency</send>
</connection>
The experiment is programmed to stopped after 5 seconds (via the "timedRun" and timedRunStopDelay" properties of the analysis block), so the experiment uses the connection twice : one at 0s, one at ~ 4.6 s. The first connection is unwanted, and I plan to disregard it on web side (either via php or python script), but is there a better way of programming the phyphox experiment? Ideally I would like to be able to trigger a connection at a given time, using the <timer> analysis module.
Also, on a side note, each time my phyphox experiment sends a data to my server, the data are received, but a message "Could not parse JSON" appears on my smartphone. I haven't investigate this yet (in fact it helps me by clearly tagging each connection), so it may be a simple problem with my server. I plan to look at it, but if this is a well known problem, I wouldn't mind any pointers.
Thank you in advance,
Cheers,
Fred
I am playing with the network connection and trying to send data to a web page using a custom phyphox experiment. If I understand correctly the wiki (https://phyphox.org/wiki/index.php/Network_Connections), there are only two ways to trigger such a connection:
- using the "interval" property of the <connection> block
- using the "trigger" property of a view button
I would like to send a data only once, after a given amount of time, and I would like to avoid using a button. The way I do it now is that I set the interval property at the proper time:
<connection interval="4.6" address="ADDRESS" id="submit" service="http/post" conversion="json" privacy="https://phyphox.org/disclaimer/" autoConnect="true">
<send id="frequency" type="buffer" init="0">frequency</send>
</connection>
The experiment is programmed to stopped after 5 seconds (via the "timedRun" and timedRunStopDelay" properties of the analysis block), so the experiment uses the connection twice : one at 0s, one at ~ 4.6 s. The first connection is unwanted, and I plan to disregard it on web side (either via php or python script), but is there a better way of programming the phyphox experiment? Ideally I would like to be able to trigger a connection at a given time, using the <timer> analysis module.
Also, on a side note, each time my phyphox experiment sends a data to my server, the data are received, but a message "Could not parse JSON" appears on my smartphone. I haven't investigate this yet (in fact it helps me by clearly tagging each connection), so it may be a simple problem with my server. I plan to look at it, but if this is a well known problem, I wouldn't mind any pointers.
Thank you in advance,
Cheers,
Fred