RepRap Mock server
-
Hi
I want to develop a HTTP client (using this spec: https://github.com/Duet3D/RepRapFirmware/wiki/HTTP-requests) and I was wondering if there's a mock server that I can use during the development?
This would greatly ease the dev process and would help me to test my client during the high load. The latter part is specially important because in production it should be able to handle thousands of devices at the same time
-
@andmaz Not yet. In SBC mode we'll provide support for
rr_
HTTP requests in v3.5 but until then you must use the Duet's HTTP server. -
@chrishamm thank you for quick reply
(wishful thinking) Would be awesome to have a simple http server (could be express.js or something else) just producing some fake data while mimicking RepRap's behaviour.
Anyway, keep up the good work
-
Hi @chrishamm sorry for pinging you but can you explain the rationale behind the
seqs.reply
value?
The docs (https://github.com/Duet3D/RepRapFirmware/wiki/Object-Model-Documentation) are not very clear about it. The only reference that I found was:There is an extra value seqs.reply as well which is used notify clients about new messages (see rr_reply).
My question is: How does the
seq.reply
increase?I'll try to explain what I mean.
For example, this request
/rr_gcode?gcode=M120%0AG91%0AG1%20X-10%20F6000%0AM121
, which results in the following responseError: G0/G1: insufficient axes homed
increases the
seq.reply
by4
. Why4
?On the other hand, this
/rr_gcode?gcode=M106%20P1%20S0.16
request, with an empty response, increases theseq.reply
by1
. Why1
?What's the difference? How the
reply
counter is increasing?The ultimate goal for me is to understand how can I relate a
/rr_gcode
req. with a/rr_reply
response.
The/rr_gcode
does not provide any info for this so I'm guessing that theseq.reply
is the answer for this. -
@andmaz said in RepRap Mock server:
For example, this request
/rr_gcode?gcode=M120%0AG91%0AG1%20X-10%20F6000%0AM121
, which results in the following responseError: G0/G1: insufficient axes homed
increases the
seq.reply
by4
. Why4
?It's probably causing 3 blank lines to be returned as well as the one containing the error message.
On the other hand, this
/rr_gcode?gcode=M106%20P1%20S0.16
request, with an empty response, increases theseq.reply
by1
. Why1
?Because it is returning a single blank response line.
The ultimate goal for me is to understand how can I relate a
/rr_gcode
req. with a/rr_reply
response.
The/rr_gcode
does not provide any info for this so I'm guessing that theseq.reply
is the answer for this.The only guarantee is that seq.reply will increment by at least one every time a new reply is generated.
-
@dc42 thank you for your response.
It's probably causing 3 blank lines to be returned as well as the one containing the error message.
Can you explain the reason for the blank lines? In what situations it returns blank lines? Can it return more that 3 blank lines?
Overall, current API makes difficult to relate the req. to
/rr_gcode
and response from/rr_reply
.It would be cool if
/rr_gcode
response could include theseq
number (e.g.,{ "buff": 226, "seq": 12345 }
) and the/rr_reply
could include theseq
in response string. This way relatingreq
andres
would be much easier. -
@andmaz said in RepRap Mock server:
Overall, current API makes difficult to relate the req. to /rr_gcode and response from /rr_reply.
DWC manages it. What I think it does is to send the command via rr_gcode and then wait for the sequence number to increase, indicating that a response has been received.
-
@dc42 yeah, I've been looking at DWC and the logic that's implemented there. However, I still continue to think that
/rr_reply
response is not consistent and could be improved (or at least documented in detail).In any case, thank you for your help