send

Synopsis

send<T>(serial: string, method: string, path: string, data: T): Promise<Response>

Parameters

Parameter Description
serial: string Serial number of the device to receive request
method: string The HTTP Verb of the Request (IE: “GET”)
path: string The URL of the Request (IE: “/ATX/about”)
data: T The body of the request

Example

Request general data from every device that sends a heartbeat and print the response on the console.

let netw = require("@altronix/linq-network-js").default;

netw.listen("tcp://*:33455")
    .on("heartbeat", sid =>
      netw
         .send(sid, "GET", "/ATX/about")
         .then(response => console.log(response))
         .catch(e => console.log(e)));

See Also

  1. get
  2. post
  3. delete