Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

innogy-smarthome-lib

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

innogy-smarthome-lib - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

lib/websocketclient/index.js

37

lib/smarthome/index.js
const inherits = require('util').inherits;
const EventEmitter = require('events').EventEmitter;
const WebSocket = require('ws');
const WebSocketClient = require('./../websocketclient');
const Promise = require('bluebird');

@@ -251,20 +252,38 @@

else {
var ws = new WebSocket('wss://' + that._requestor._config.baseConfig.apiHost + that._requestor._config.baseConfig.versionPrefix + 'events?token=' + status.token.access_token);
var reconnectCount = 0;
var ws = new WebSocketClient('wss://' + that._requestor._config.baseConfig.apiHost + that._requestor._config.baseConfig.versionPrefix + 'events?token=' + status.token.access_token);
ws.on('message', function (data) {
var eventArray = JSON.parse(data);
eventArray.forEach(function (event) {
if (event && event.link) {
var cap = that.resolveLink(event.link);
if (Array.isArray(eventArray)) {
eventArray.forEach(function (event) {
if (event && event.link) {
var cap = that.resolveLink(event.link);
if (cap) {
cap.parseEvent(event);
that.emit("stateChanged", cap);
if (cap) {
cap.parseEvent(event);
that.emit("stateChanged", cap);
}
}
}
});
});
} else {
that.emit('error', eventArray);
}
});
ws.on('open', function () {
reconnectCount = 0;
});
ws.on('error', function (e) {
that.emit('error', e);
});
ws.on('close', function (e) {
that.emit('error', {error: "closing socket", code: e});
});
that._wsClient = ws;

@@ -271,0 +290,0 @@ resolve(ws);

{
"name": "innogy-smarthome-lib",
"version": "0.1.2",
"version": "0.1.3",
"description": "JavaScript library for the Innogy SmartHome system",

@@ -5,0 +5,0 @@ "main": "./lib/smarthome",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc