WebSocket Connection Error getting live streams after login

Hello everyone,

I am using XPMobileSDK WebClient with JS.

I am trying to get Live Stream from a Mobile Server.

Connection and Login operation done but when try to get live stream i get this Error:

WebSocket connection to ‘wss://XXX.XXX.XXX.XXX:8082/XProtectMobile/Video/d1e7e5c2-08ce-414e-8116-4a1b105b3e47/’ failed:

in browser console.

Best regards,

Marcello

I tried to test the connection getting ‘410 Gone’.

Hi,

Could you please provide us with some more data what commands you send.

The error you see looks like the endppoint on the server side is closed. This may happen if you do not get video for some time .

Hello,

i send command RequestStream.

I can access to the server, how can i verify if the server side is closed?

Whatever I can login and get cameras from server, seems like only get video doesn’t work.

Thank you very much

Can you please provide us with logs from XProtect Mobile Server : [C:\ProgramData\Milestone\XProtect](file:C:/ProgramData/Milestone/XProtect) Mobile Server\Logs.

Also a wireshark trace with the communication between Server and your client can be useful (Make sure it is a http connection)

Hello Svetlana,

the logs say:

2022-05-23;08:40:30;Error;HttpListenerAsync.ListenerCallback;I / O operation terminated due to thread exit or application request.

I solved replacing HttpsHeader in VideoOS.MobileServer.Service.exe.config like this:

<HttpHeaders>
      <add key="Content-Security-Policy" value="default-src 'self'; script-src 'self' https://www.gstatic.com http://www.googletagmanager.com/gtag/js; connect-src 'self' ws://*:* wss://*:* https://www.google-analytics.com/ https://firebaseinstallations.googleapis.com/; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline'; frame-ancestors 'self'; media-src data: blob: 'self' mediastream:;" />
      <!-- Keep in mind that if you have to use any XML special characters in the X-Frame-Options header they MUST be replaced with their equivellent ones
           (<) -> &lt; , (&) -> &amp; , (>) -> &gt; , (") -> " , and (') -> &apos; -->
      <add key="CSP-Analytics" value="script-src 'self' https://cdn.firebase.com https://*.firebaseio.com" />
      <add key="X-Frame-Options" value="DENY" />
      <add key="Access-Control-Allow-Origin" value="*" />
      <!--values should be separated with comma -->
      <add key="Access-Control-Allow-Methods" value="GET,HEAD,OPTIONS,POST,PUT" />
      <add key="Access-Control-Allow-Headers" value="Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers" />
      <add key="X-XSS-Protection" value="1; mode=block" />
      <add key="Strict-Transport-Security" value="max-age=31536000" />
      <add key="ConnectionId" value="False" />
    </HttpHeaders>

Thank you very much for the support.

HI Marcello,

Sorry for the “stupid” question, but can you ensure that MIlestone XProtect WebClient is working fine on the same browser where you experience this problem and that the WebSockets are enabled in the network ?

Hi Petar,

the WebClient is working.

I solved modifyng HttpHeaders in VideoOS.MobileServer.Service.exe.config to allow Access-Control-Allow-Methods.

Thank you for the support