Skip to content

Commit

Permalink
enable libre
Browse files Browse the repository at this point in the history
  • Loading branch information
TA2k committed Mar 29, 2024
1 parent 02f6ff3 commit 598c6b6
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 2,017 deletions.
11 changes: 11 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
const utils = require("@iobroker/adapter-core");
const axios = require("axios").default;
const Json2iob = require("json2iob");
const { createHTTP2Adapter } = require("axios-http2-adapter");
const http2 = require("http2-wrapper");

class Libre extends utils.Adapter {
/**
Expand All @@ -22,6 +24,15 @@ class Libre extends utils.Adapter {
this.on("unload", this.onUnload.bind(this));
this.deviceArray = [];
this.json2iob = new Json2iob(this);

const adapterConfig = {
agent: new http2.Agent({
/* options */
}),
force: true, // Force HTTP/2 without ALPN check - adapter will not check whether the endpoint supports http2 before the request
};

axios.defaults.adapter = createHTTP2Adapter(adapterConfig);
this.requestClient = axios.create();
this.header = {
"Content-Type": "application/json",
Expand Down
Loading

0 comments on commit 598c6b6

Please # to comment.