NEWS
using iobroker.socket-client in a NodeJs project
-
Hi, I'm in the process of writng a NodeJs project that will talk to IOBroker.
According to npm:
@iobroker/socket-client@1.1.14
when I try to create a connection, I get:
ReferenceError: window is not defined at P:\Projects\Vue\logik\logik-backend\node_modules\@iobroker\socket-client\dist\cjs\Connection.js:123:7 at new Promise (<anonymous>) at Connection.waitForSocketLib (P:\Projects\Vue\logik\logik-backend\node_modules\@iobroker\socket-client\dist\cjs\Connection.js:122:34) at new Connection (P:\Projects\Vue\logik\logik-backend\node_modules\@iobroker\socket-client\dist\cjs\Connection.js:87:10)As I understand it, this happens because "window" is not defined in NodeJS projects [I am by no means an expert JS programmer, btw]
So.
Is this the right library for the job?
Does it in fact support Node?
Am I missing some bit of initialisation to create a suitable "window" object under node.Hints appreciated.
-
Hi, I'm in the process of writng a NodeJs project that will talk to IOBroker.
According to npm:
@iobroker/socket-client@1.1.14
when I try to create a connection, I get:
ReferenceError: window is not defined at P:\Projects\Vue\logik\logik-backend\node_modules\@iobroker\socket-client\dist\cjs\Connection.js:123:7 at new Promise (<anonymous>) at Connection.waitForSocketLib (P:\Projects\Vue\logik\logik-backend\node_modules\@iobroker\socket-client\dist\cjs\Connection.js:122:34) at new Connection (P:\Projects\Vue\logik\logik-backend\node_modules\@iobroker\socket-client\dist\cjs\Connection.js:87:10)As I understand it, this happens because "window" is not defined in NodeJS projects [I am by no means an expert JS programmer, btw]
So.
Is this the right library for the job?
Does it in fact support Node?
Am I missing some bit of initialisation to create a suitable "window" object under node.Hints appreciated.
-
@alcalzone That was my assumption.
Is there a NodeJs version?
I can always use the basic REST interface, but it wouldn't be my first choice here...
-
@alcalzone That was my assumption.
Is there a NodeJs version?
I can always use the basic REST interface, but it wouldn't be my first choice here...
-
@taragorm if you will use normal "ws" library for node.js, it will be possible to communicate with ioBroker. But ioBroker.rest-api is very advanced and supports long polling and web hooks for events.
-
@taragorm if you will use normal "ws" library for node.js, it will be possible to communicate with ioBroker. But ioBroker.rest-api is very advanced and supports long polling and web hooks for events.
Hey! Du scheinst an dieser Unterhaltung interessiert zu sein, hast aber noch kein Konto.
Hast du es satt, bei jedem Besuch durch die gleichen Beiträge zu scrollen? Wenn du dich für ein Konto anmeldest, kommst du immer genau dorthin zurück, wo du zuvor warst, und kannst dich über neue Antworten benachrichtigen lassen (entweder per E-Mail oder Push-Benachrichtigung). Du kannst auch Lesezeichen speichern und Beiträge positiv bewerten, um anderen Community-Mitgliedern deine Wertschätzung zu zeigen.
Mit deinem Input könnte dieser Beitrag noch besser werden 💗
Registrieren Anmelden