events not working
See original GitHub issueI tried with node 6.10, 8.0, 8.1. I’m not sure if it’s related to camera (some clone from china), since I can see events in its manager (some internet explorer activex plugin), but… if someone else also has this problem, then there might be something here to explore…
var CAMERA_HOST = '192.168.1.10',
USERNAME = 'admin',
PASSWORD = '',
PORT = 8899;
var http = require('http'),
Cam = require('onvif').Cam;
new Cam({
hostname: CAMERA_HOST,
username: USERNAME,
password: PASSWORD,
port: PORT
}, function(err) {
if (err) {
console.log('Connection Failed');
return;
}
console.log('CONNECTED');
this.on('event', function(camMessage) { console.log(camMessage) });
});
Error: You should create pull-point subscription first! at Cam.pullMessages (/home/mm/Downloads/tempp/node_modules/onvif/lib/events.js:137:9) at Cam._eventPull (/home/mm/Downloads/tempp/node_modules/onvif/lib/events.js:196:8) at Cam.<anonymous> (/home/mm/Downloads/tempp/node_modules/onvif/lib/events.js💯12) at ClientRequest.<anonymous> (/home/mm/Downloads/tempp/node_modules/onvif/lib/cam.js:225:4) at emitOne (events.js:115:13) at ClientRequest.emit (events.js:210:7) at Socket.socketOnEnd (_http_client.js:435:9) at emitNone (events.js:110:20) at Socket.emit (events.js:207:7) at endReadableNT (_stream_readable.js:1045:12)
– and when I remove require (‘http’) (wich should not be a problem), then error changes to:
TypeError: Cannot read property 'events' of undefined
at Cam._request (d:\moje\pcele\nodetesting\test_onvif3\node_modules\onvif\lib\cam.js:175:16)
at Cam.createPullPointSubscription (d:\moje\pcele\nodetesting\test_onvif3\node_modules\onvif\lib\events.js:87:10)
at Cam._eventRequest (d:\moje\pcele\nodetesting\test_onvif3\node_modules\onvif\lib\events.js:183:14)
at Cam.<anonymous> (d:\moje\pcele\nodetesting\test_onvif3\node_modules\onvif\lib\events.js:170:14)
at emitTwo (events.js:125:13)
at Cam.emit (events.js:213:7)
at _addListener (events.js:248:14)
at Cam.addListener (events.js:298:10)
at Cam.<anonymous> (d:\moje\pcele\nodetesting\test_onvif3\app.js:12:10)
at Cam.<anonymous> (d:\moje\pcele\nodetesting\test_onvif3\node_modules\onvif\lib\cam.js:104:13)
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top GitHub Comments
@bartbutenaers I’m afraid I didn’t. Had to move on with some other projects, so this was left on the “someday” list 😃 Sorry…
I have rewritten parts of the events code and it works nicely with Hikvision and Axis equipment. The new code handles the missing wsa:To field in the XML and subscribes to the pull point first. Example6.js gives a simple demo.
So I will close this issue report as we have now code for events. Please raise a new report if you still have problems. Thanks