Skip to content

Commit

Permalink
set keepAlive for http connection (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta authored Mar 17, 2024
1 parent 3dca237 commit be6f103
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/nanoleaf-aurora-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ const fs = require('fs'),
EventSource = require('eventsource'),
timeout = 2000;

const httpAgent = new http.Agent({
keepAlive: true,
maxSockets: 1
});

var AuroraApi = module.exports = function (options) {
var self = this;

Expand Down Expand Up @@ -40,7 +45,8 @@ var AuroraApi = module.exports = function (options) {
port: this.port,
path: `${this.base}${this.accessToken}${pathname}`,
method: method,
timeout: this.timeout
timeout: this.timeout,
agent: httpAgent
}

return options;
Expand Down

0 comments on commit be6f103

Please sign in to comment.