React Native
React Native
Send HTTPS Get Without Waiting for the Response
See more REST Examples
This example demonstrates sending an HTTP GET request without waiting for the response.Chilkat React Native Downloads
import { Rest } from '@chilkat/react-native'
async function chilkatExample() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const rest = new Rest();
// Connect to the server using TLS
const bAutoReconnect = false;
try {
await rest.connectAsync('example.com', 443, true, bAutoReconnect);
} catch {
console.log(rest.lastErrorText);
return;
}
// Send a GET request to https://example.com/some/path
try {
await rest.sendReqNoBodyAsync('GET', '/some/path');
} catch {
console.log(rest.lastErrorText);
return;
}
// OK, the request was sent.
// Close the connection.
const maxWaitMs = 50;
await rest.disconnectAsync(maxWaitMs);
console.log('GET Request Sent.');
}