2 years ago

#43152

test-img

Max Jacobson

Sending a fetch request while connected to an iOT device without internet

I'm developing an iOS app using Ionic (JavaScript Framework) and I'm connecting to an Iot device and sending a fetch request to it.

If my phone doesn't have a cellular connection, the fetch fails.

This is the process:

  1. Turn on Iot device

  2. Use app to connect to device access point

  3. Send fetch request to device

     try {
       const response = await fetch('http://192.168.1.1/');
       // handle response
     } catch(err) {
       console.log(err);
       // handle error
    }
    
  4. Fetch fails

Is there a way for the fetch to work when connected to an access point without internet? Are there any other libraries that might help me achieve this?

javascript

ionic-framework

fetch

iot

access-point

0 Answers

Your Answer

Accepted video resources