Is the Nx Cloud up? Visit our Status Page for the current health and performance of the Nx Cloud.

Status Page

WebRTC Connection Failing with Error 1006 - Authentication Issue?

Answered

Comments

1 comment

  • Ichiro
    • Network Optix team

    Hi Alicia Peralta Linares

    Thanks for your questions. 

    The error is caused by using the wrong authentication method.Since Nx Witness v5.1, OAuth2 session tokens are the required and recommended approach.

    From the URLs you shared, you’re using HTTP Basic, which isn’t supported by Nx Witness default authentication. Please switch to the session-token flow. You can refer to the sample code here for the exact steps .

    For WebRTC, we recommend the official Nx WebRTC Manager. It leverages Nx Cloud (required) and makes the connection straightforward—just provide the cloud_system_id and camera_id. Please review the package and README when you have a chance.

     

    1. **Does the WebRTC WebSocket endpoint require authentication headers instead of URL credentials?** Should I send an `Authorization: Basic` header?

    It requires header, but the header should be “Authorization: Bearer {Token}”

    2. **Is there a specific handshake or authentication message** I need to send immediately after WebSocket connection opens?

    No, there is no specific or special authentication message. 

    3. **Does the endpoint require any specific WebSocket subprotocols** in the connection request?

    No, standard websocket in wss is good.

    4. **Are there any CORS or security settings** on the NX server that need to be configured for WebRTC WebSocket connections?

    CORS issue is asked to be handled from the client side due to the security concern of OPTIONS method and on-the-fly pre-request. So if you have CORS issue, please simply use proxy to solve this, and it is for most of the common use cases.

    5. **Is the endpoint path correct?** Should it be `/rest/v3/devices/{cameraId}/webrtc` or something else?

    Yes, it is correct, but you need to use the right authentication scheme, please refer to the answer above.

    0

Please sign in to leave a comment.