agsh / onvif

ONVIF node.js implementation
http://agsh.github.io/onvif/
MIT License
679 stars 230 forks source link

Unsubscribe: Triggers a second unsubscribe via _eventRequest #316

Open nrbfusus opened 4 months ago

nrbfusus commented 4 months ago

https://github.com/agsh/onvif/blob/768bc8b4220a31c1813c3e78355e45e8a6826605/lib/events.js

When calling Cam.prototype.unsubscribe, a second unsubscribe is then soon triggered that passes no event data. This second call originates from Cam.prototype._eventRequest and passes no callback method, so the throw new Error('You should create pull-point subscription first!') goes unhandled, as the call in eventRequest is not in a try/catch.

I am not sure why this second call to unsubscribe is triggered, as part of the unsubscribe flow, and have not been able to correctly handle the error that is thrown as result of it.