How long can you keep a mip sdk mobile connection alive?

We have a server process (really an api) running that accepts requests from our clients for camera streams. The client passes in the camera id, we get a connection to the MIP sdk mobile api, authenticate using a predefined XProtect user, get camera stream url, and send the url back to the client.

This works pretty well but we want to keep the connections alive to speed up future camera stream requests. We do this by issuing a LiveMessage command to the /XProtectMobile/Communication endpoint every 15 seconds (it looks like the mobile server is configured to drop unused connections after 30 seconds).

<?xml version="1.0" encoding="UTF-8"?>
<Communication>
   <ConnectionId>a1088684-ad13-42c1-b9f3-0c08cc5e9b3d</ConnectionId>
   <Command>
      <Type>Request</Type>
      <Name>LiveMessage</Name>
   </Command>
</Communication>

This seems to work but I’m wondering how long can you practically keep a connection alive? 20 minutes, an hour, 24 hours? What is reasonable here?

Hi David,

Mobile connection’s lifespan is configured under Management Client -> Mobile Server -> Connectivity -> Client timeout. Default value is 30 seconds indeed, but it’s possible to increase the timeout to 5 minutes. Anything beyond 5 minutes was deemed too much and is not currently possible. The reason is we want to prevent the case of having allocated unused server resources for too long, in case client omits to disconnect explicitly (e.g. when closing the browser).

P.S. LiveMessage is the right way to keep the connection open. That’s what Milestone-built clients do.

Br,
Nikolay

Okay, thank you for the information, but how long can I keep a connect alive using LiveMessage? Can I do that forever or is it best to eventually let it die and create a new one?

You can do it as long as you need the connection. I’m not aware of any drawbacks.

Great, thank you!