Nevertheless! Party Metaphorically

    wotnectivity-sse

    1.0.0 • Public • Published

    WoTnectivity SSE

    A connection library for the SSE based requests. This library works with text/event-streams delimited by \n and also with application/nd-json as content-type: of the requests.

    Install WoTnectivity-SSE

    ⚠️ Requirements: You need to have installed node and npm.

    The first thing you need to do is install wotnectivity-sse as a dependency in your project.

    foo@bar:~$ npm i wotnectivity-sse --save

    Check if the package.json of your project contains the library as a depencency.

    Examples

    In the next fragments of code you can see different use cases of SSE requests.

    • Read a value from the address with a GET petition.
      • response: reponse from the server.
    var Wotnectivity = require("wotnectivity-sse");
     
    var address = "http://192.168.1.38";
    var payload = {};
    var configuration = { requestType: "SSE", headers: {content-type:"application/json"}};
    
    let response = await Wotnectivity.sendRequest("http://192.168.1.21/property/status/sse", configuration, payload)
      response.subscribe((data)=>{
        console.log(data)
      })

    The configuration parameter of the request needs to have can have the following parameters:

    • requestType where the type of request will be declared. The request type can be of three different types:

      • SSE: Sends a SSE request to an address.
    • (optional) headers: Defines the headers of the request.

    The library works over http and https.

    Install

    npm i wotnectivity-sse

    DownloadsWeekly Downloads

    11

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    5.2 kB

    Total Files

    4

    Last publish

    Collaborators

    • manelme