Open TylerLafayette opened 7 years ago
Hello, sorry to hear that. Unfortunately, this problem is known and it is outside my control as the problem is located in the node wrtc module.
My experience generally says that it is best (for the stability of this module) to download prebuilt binary images (which requires node version like 6.9) on Mac OS or a Linux without X11 (like Linux server). But even then the Linux version is quite unstable for some reason. The problem seems to be well known for the wrtc developers, but the development is slow and does not seems to resolve it fast.
However, this code is made to work with any compatible WRTC module.
So I have done tests with electron-webrtc as well, and it seems to be more stable on linux (however, having the cost of the enormous overhead of electron).
This is a simple example of how to use electron-webrtc:
let cloud = require('node-unifiapi/cloudapi'); let wrtc = require('electron-webrtc')({ headless: true });
let r = cloud({ device-id: 'xxx-xxx-xx', username: 'xxx', password: 'xxx', webrtc: wrtc, waiter: 1000 }).api;
r.stat_sessions().then(data => console.log('Success', data).catch(err => console.log('Error', err);
The unifiapi uses the standard webrtc api. By default it is installing node-wrtc module. But you can load any other webrtc module, instead, if the wrtc is not stable enough for you.
Delian
On Mon, Jul 24, 2017 at 2:45 AM, Tyler notifications@github.com wrote:
When I run the example for the Cloud Access with my credentials I get this error: Segmentation fault (core dumped) When I change the credentials to be incorrect I just get a long JSON error. My code is exactly the same as the code in the example but here it is just in case:
let r = cloud({ deviceId: '892se6-734c-461c-9ca8-e80bgdf5c226', // The cloud id of the device username: 'TylerLafayette', password: '
', // debug: true, // More debug of the API (uses the debug module) // debugNet: true // Debug of the network requests }); r.api.stat_sessions() .then((data) => { console.log('Stat sessions', data); return r.api.stat_allusers(); }) .then((data) => { console.log('AP data', data); }) .catch((err) => { console.log('matError', err); })``` — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/delian/node-unifiapi/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG7ZgCRA12ebmr2WPq7ngUK0uWc0R5mks5sQ-kggaJpZM4Ogn3Z .
When I run the example for the Cloud Access with my credentials I get this error:
Segmentation fault (core dumped)
When I change the credentials to be incorrect I just get a long JSON error.
My code is exactly the same as the code in the example but here it is just in case: