question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

events not working

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
Codelicacommented, Mar 5, 2019

@bartbutenaers I’m afraid I didn’t. Had to move on with some other projects, so this was left on the “someday” list 😃 Sorry…

0reactions
RogerHardimancommented, Nov 18, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Event listeners not working? 3 key areas to troubleshoot
Are your event listeners not working as you'd expect? Here are 3 key areas to troubleshoot to help you get everything triggering as...
Read more >
Troubleshoot the event setup tool for web in Meta ... - Facebook
The event setup tool in Meta Events Manager helps you set up events and parameters on your website without code. Learn how to...
Read more >
Events not firing (or being handled) - Laracasts
Events not firing (or being handled) ... Long story short, I'm firing an event when a user registers, but the handler which sends...
Read more >
Fix sync problems with the Google Calendar app - Android
Use this page if events you created or updated aren't showing on your computer or in the Google Calendar app. First, try these...
Read more >
Events are not working · Issue #743 · lit/lit-element - GitHub
As seen in the following screenshot, the event is said to be emitted but it never executes the given function, which would log...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found