Hi Richard,
You are right. The information provided is not complete in order to easily implement the protocol by yourself.
I would assume you are using platform that is not in the supported ones by the MIP SDK Mobile. If that is not the case I’ll highly encourage you to try to use one of the SDKs.
I’ll try to address your questions bellow:
Q: When connecting, for example, what format should the client’s public key be in?
A: Client public key is in form of base64 encoded string.
Advice: Making DHKE work is a hard task on it’s own. In the beginning you could try to skip that. For this to happen you should not provide PublicKey on the Connect command. In addition have to be made change in the Mobile server configuration file. Please open it and find “” tag. In it, right after “” add:
<Credentials>
<add key="PlainTextAuthenticationEnabled" value="True"/>
</Credentials>
Using plain text credentials could be dangerous and is by default prohibited. But for debugging purposes, as well as if your Mobile server is running on HTTPS it could be quite handy.
Q:Can I make up my own client ID?
A: No. ConnectionId is generated by the server in the response of the Connect command. So basically the first command you send is Connect. And for it you do not specify ConnectionId. On the response of the command you receive (in the XML data) connectionId, that is used for all the subsequent commands to the MoS (Mobile Server).
Q: Is it like the Image Server API, where you can (must) keep the connection open, or is it one connection per request?
A: No. The MoS protocol is HTTP based. So you should comply with the HTTP standard. If you are using HTTP/1.1 you can use different TCP connections for every HTTP request. Or you could share same TCP connection, as well as you wait for the response from the previous request first. If you are using HTTP/2.0 you could have multiple HTTP request one after another, before to receive the first HTTP response.
Q: “The client always initiates HTTP request which contains exactly one XML message…” but on this page it says “There is a commands separator (separator between different XMLs send on the link), which is two new lines (“\r\n\r\n”). It should be possible for the client to send multiple commands before to retrieve any server response.” which seems to disagree.
A: In it’s initial form and release MoS Protocol supported possibility multiple commands to be send one after another in a single request. This however seemed to introduce more troubles than to solve actual problems. So now this strategy is abandoned and is not supported. The message separator (unfortunately) left from this times.
So now there is a clear 1:1 relation between commands and HTTP request.
Q: The intro page has a communication flow diagram, which is helpful but again doesn’t provide enough information to actually use the protocol.
A: Well the actual session could vary depending on what the actual integration would be. The common thing between all the sessions is the order of the commands. It should be:
Connect
Login
<any_other_command>
Disconnect
So you should always start with Connect and Login after that. And call Disconnect when you finished your work with the MoS.
Q: Is there somewhere that explains exactly what each parameter is (including its format and, where appropriate, where it comes from) and ideally gives example message flows using the XML messaging?
A: I’m not sure we have such detailed information on the protocol level. It would be quite difficult to support such.
Q: What I would ultimately like to do is use the XML protocol to export and download [untranscoded] clips of video from a specified camera. It sounds like I can connect, log in, and trigger the export (although I now see that the StartExport command is obsolete!), I haven’t worked out how to get the exported video yet. So ideally, I would also like an example of using the XML protocol to do all that!
A: Well, I’m not sure we could/would provide such an example. What I could advice you is to try to use one of the Web Samples and look at the traffic in the browsers Network tab. If I remember well we do have “VideoExport” sample, which is something very close to what you want to achieve.
As for the “StartExport” command - yes, it is really an obsolete one. It is still supported by the MoS, but could be removed in future versions.
In the response of the “StartExport” command you get “ExportId”. This Id could be further used with “GetExport” command. It will return the status of the export (0 to 101) as well as (relative) link for a download.
Please bear in mind that in future version download could require call of yet another command.
In general export commands are considered as obsolete as they are replaced by Investigations commands. In short you should first “CreateInvestigation” and later call “StartInvestigationExport”. Investigations are in general more feature rich and also support audio. Otherwise both Investigation exports and obsolete (old) exports support the same export formats - XProtect (DB), AVI and MKV. I would suppose you are targeting MKV exports.