When using the library to connect to a Meshtastic radio, the Ping method attempts to fetch from hotspot-detect.html. Unlike the /api endpoints, the Meshtastic device HTTP server doesn't set any CORS headers on the hotspot-detect.html response. As a result, the PING will fail:
Since meshtasticjs doesn't actually check the response from the server in this instance - just needs the request to go through, we can use mode: no-cors and allow this fetch to resolve successfully.
When using the library to connect to a Meshtastic radio, the Ping method attempts to fetch from
hotspot-detect.html
. Unlike the/api
endpoints, the Meshtastic device HTTP server doesn't set any CORS headers on thehotspot-detect.html
response. As a result, the PING will fail:Since meshtasticjs doesn't actually check the response from the server in this instance - just needs the request to go through, we can use
mode: no-cors
and allow thisfetch
to resolve successfully.