Giter VIP home page Giter VIP logo

httpclientesp32ex's Introduction

HTTPClientESP32Ex

Customized version of ESP32 HTTPClient Library v 1.2.0.

Allow custom header and payload string sending for http and https connections.

Thhis library intend to use as part of my Firebase-ESP32 and LineNotify-ESP32 libraries for Arduino for sharable WiFi client.

Usage

/**
* Initialization of new http connection.
* \param host - Host name without protocols.
* \param port - Server's port.
* \param uri - The URI of resource.
* \param CAcert - The Base64 encode root certificate string
* \return True as default.
* If no certificate string provided, use (const char*)NULL to CAcert param 
*/
bool http_begin(const char* host, uint16_t port, const char* uri, const char* CAcert);

/**
* Check the http connection status.
* \return True if connected.
*/
bool http_connected();

/**
* Establish http connection if header provided and send it, send payload if provided.
* \param header - The header string (constant chars array).
* \param payload - The payload string (constant chars array), optional.
* \return http status code, Return zero if new http connection and header and/or payload sent 
* with no error or no header and payload provided. If obly payload provided, no new http connection was established.
*/
int http_sendRequest(const char* header, const char* payload);

/**
* Send extra header without making new http connection (if http_sendRequest has been called)
* \param header - The header string (constant chars array).
* \return True if header sending success.
* Need to call http_sendRequest with header first. 
*/
bool http_sendHeader(const char* header);

/**
* Get the WiFi client pointer.
* \return WiFi client pointer.
*/
WiFiClient* http_getStreamPtr(void);


/**
* Set debug print to serial.
* 
* \param cb - callback function that accept constant char array (const char*).
*/
void setDebugCallback(DebugMsgCallback cb);

    
/**
* Start connect to host.
* 
* \return bool status of connection.
*/
bool http_connect(void);

/**
* Start connect to host with STARTTLS command.
* 
* \return bool status of connection.
*/
bool http_connect(bool starttls);

httpclientesp32ex's People

Contributors

mobizt avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.