This package has been deprecated

Author message:

replaced by httpservice

@mangar2/httpclient

2.0.1 • Public • Published

Abstract

This is a very simple http web client. It is based on the http packet included in node.js. I built it due to its simplicity and the independence from other packages

Functionality

The class provides a simple interface to publish data to clients.

Usage example

  • Create a lient with host and port let client = new HttpClient("127.0.0.1", 9001);
  • Register a callback to get the result client.on("result", result => console.log(result))
  • Send a GET to 127.0.0.1:9001/clients with the body test client.send("/clients", "GET", "test", {'Content-Type': 'application/json', packetId: 1, mqttpacket: "publish"} );

supported callbacks

  • result(statusCode, headers, payload)
  • error(err) or any error

close

The static close method closes all open connections for all pending requests

/@mangar2/httpclient/

    Package Sidebar

    Install

    npm i @mangar2/httpclient

    Weekly Downloads

    1

    Version

    2.0.1

    License

    LGPL-3.0-or-later

    Unpacked Size

    7.55 kB

    Total Files

    4

    Last publish

    Collaborators

    • mangar2