Connection dropping using Duet Web API with fetch
-
Re: Connection dropping using Duet Web API from python script
Hi
I'm currently working on custome gui for duet and using HTTP requests https://github.com/Duet3D/RepRapFirmware/wiki/HTTP-requests
I am able to connect and receive data, but the problem occurs when fetches are performed asynchronously and starts 4 times in an interval of 250 milliseconds, then after some time the fetch status appears net::ERR_SOCKET_NOT_CONNECTED, it is random and some fetches are executed correctly. does it have to do with limited duet 3d memory? and I need to limit the number of queries sent to API? Additionally, while my application is running, I run Duet Web Control and it disconnects the connection from time to time
-
@Seba7890 one for @chrishamm
-
@Seba7890 Yes, that's likely the cause, Duets in standalone mode only have a limited number of sockets (especially Duet 2 Ethernet). You should make all update polls sequential, DWC does that, too.
-
So if I need to receive data asynchronously, I need to connect a raspberry pi to Duet 3d and set up DuetWebServer and use the REST API https://github.com/Duet3D/DuetSoftwareFramework/wiki/REST-API
-
@Seba7890 Unless you use workers, JavaScript in browsers runs only on one thread anyway. What's the motivation behind keeping all the requests asynchronous?
DSF (in SBC mode with RaspPi) pushes over object model changes using a WebSocket so there is less overhead. Also note that there is a generic connector library available both for standalone and SBC mode, see https://www.npmjs.com/package/@duet3d/connectors You could use that as well in both cases.