WebRTC API Authentication problem
In ProgressI am developing a web page using the Nx API.
During this process, I encountered a problem while trying to monitor video using the webrtc-tracker API and WebSocket.
When I make a WebSocket connection request like the code above, it fails.
error message:
WebSocket connection to 'wss://{NxServerIp}:{NxServerPort}/webrtc-tracker/?camera_id={camId}&position=null&speed=unlimited&stream=primary&auth={authKey}' failed:
However, if I log into the Nx WebAdmin homepage and then run it again, the WebRTC video is monitored normally.
Am I using HTTP Digest authentication incorrectly?
Should I use a different authentication method?
If you know any solution, please let me know.
[Additional info]
1. Nx version: 5.1.1.37512
2. Process of creating the authKey for HTTP Digest authentication
-
Hi Kevin,
Have you enabled the digest authentication?
https://support.networkoptix.com/hc/en-us/articles/7724435803415-How-to-Enable-Digest-Authentication-for-3rd-Party-Applications -
Hi Maria Smith , kevin
Thanks for the information, I will do some investigation and check with our developers if required.
BTW, I have the same result as Maria at the moment, the HTTP webrtc looks no issue, but on the web socket one likely.
If you have any urgency, you are suggested to update the system to latest v5.1.4 and use webrtc via HTTP as of now.
I will check and get back to you once there are any findings.
Thanks. -
Hi Maria Smith , kevin
May I know what exact the error message you saw in your code?
I was able to pass the authentication though, can you provide the code to us for investigation? -
Hi Kevin,
Using WebRTC is quite straightforward. You can obtain the stream via HTTP with the appropriate authentication. There’s an existing tutorial with sample code available in the knowledge base that you can refer to here.
Nx offers the WebRTCStreamManager, which makes handling this task easy. Additionally, please note that it is recommended to update your system to the latest version, 5.1.4. We’ve made several improvements and fixes from version 5.1.1 to 5.1.4 and beyond, which will aid in any future troubleshooting.
Thank you.
-
Hi Maria Smith,
Do you mean the WebRTCStreamManager not working for you? or the websocket one? -
Ichiro we are also struggling making the wss connection to the Nx server as the original post above.
-
Hi Maria Smith,
Have you got the token from proper source? (cloud:nxcdb-xxx , or local:vms-xxxxx)
Once you have got the tokens , attach them to the header under x-runtime-guid=<token>This should be working.
-
Hi Ichiro,
Yes, we are getting a token and able to pass it. We retrieve footage information this way. But the request from Nx was to submit through the WebRTCStreamManager and for that we provide the token and it is handled within the dll. Only it seems to go in circles there.
Alternatively we would prefer to do a web socket direct to Nx Server but are having the same issues as Kevin above.
-
Hi Maria Smith,
Thanks for your feedback and suggestions.
I am not sure if you have tried to add x-runtime-guid=<token> in your headers while you are using websocket? BTW, x-runtime-guid=<token> would be applied to both HTTP/Websocket.
So we kindly ask if you can put the auth_token in your websocket header,(you may refer to this post) and let us know if you can successfully work with it?
Regarding to your issue about WebRTCManger, it may require more detail, if you have any possible reproduced steps, we are happy to investigate. Thanks.
-
Hello Ichiro
Thanks for suggestions.
I already tried to add token in HTTP connection it's not working for us and I am integrating Websocket from Js side so there is no way to add x-runtime-guid=<token> inside the header.I've also referred to a post you mentioned, but unfortunately, it hasn't resolved our issue either.
Do you happen to have any example codebase or proper documentation that could assist us in establishing a direct connection with NX without using WebRTCManger? If so, could you please share it with us?
Please sign in to leave a comment.
Comments
17 comments