i am using Xprotect 2023 R1 with distributed setup. Management server and event server are separated. When i tried getting alarms using the AlarmList sample from the milestone protocol integration github, it throws the error that the Central/AlarmService2 endpoint is not listening.
The sample does not support the scenario of a distributed system. The sample makes the assumption that the address of the Management Server used for login can be reused for communicating with the Event Server on default port.
The sample should in order to work do this instead: After the login it should use the Service Registration service to get the address and port of the Event Server, then use this info to communicate with the Event Server.
We have in Milestone Development discussed to improve the sample, but the sample might be removed instead because there is a new restful API.
https://doc.developer.milestonesys.com/mipvmsapi/api-overview/integrations/alarms/
There is a sample.
It is important to note that the new sample will not work for 2023R1..
The Alarms API is beta in 2023R2 and 2023R3.
The system has been upgraded to R3. However some of the API isn’t working as expected. The api such as get all events or alarms returns with a html response saying “Service not available”. The api to get token and get all cameras is working as expected.
I’ve attached an image of the response.
I’ve also tried the python websockets sample for events and state. It seems that the websocket client connected however when sending the json command, the same json is received but without the expected status property.
This is an example of the json string sent and received :
{“commandId”:“935727b2-7b12-4982-af74-ffd0208c53d5”,“command”:“startSession”,“sessionId”:“”,“eventId”:“”}
What license are you using? Alarms are not available with Essential.
Can you attach the event server logs?
License is corporate 2023R3. Attached the event logs.
Do you receive sessionId in the response?
no session id property in the response as shown in the image i attached in my earlier reply.
Do you have Encryption:On on your server?
If so, try to GET alarms or events with https
About the websocket sample: Can you try to do some steps with Postman?
Create a new Websocket request to wss:///api/ws/events/v1 and Authorization like here:
with the next message:{
_"command": "startSession",_
_"commandId": 1_
}
First click Connect button, and then Send - what response will you have?
Did not turn encryption on for the server. GET alarms or events fail with service unavailable. However Get Cameras api works fine.
I’ll try with the Websocket request on postman and update soon.
All the api calls works now. However there’s still an issue with the websocket api. I’ve managed to start a session and add subscription and receive event messages in json however if my client stop the connection and tries to reconnect again, it’s unable to.
I’ve attached the logs for this.
Also, i noticed the json response for websocket and restful api for events is different.
This is the event json from websocket :
{“events”:[{“specversion”:“1.0”,“type”:“6f55a7a7-d21c-4629-ac18-af1975e395a2”,“source”:“cameras/7e22edab-3482-4e21-950f-7afd876a0605”,“id”:“cad6aaa6-2f3c-48d1-aabf-1d0c0cb44001”,“time”:“2023-12-21T07:33:13.406Z”,“stategroupid”:“720ef62a-78be-418a-8e4c-ee04ffca6429”}]}
and this is from the restful api :
{
“array”: [
{
“specversion”: “1.0”,
“type”: “06c5010d-11f2-4d70-bd79-4cec3a20d589”,
“source”: “sites/aec10c7a-4dc7-4034-8984-56bf196ff67f”,
“time”: “2023-12-20T06:17:17.9249935Z”,
“id”: “f4cd4a40-e35d-4a1b-a748-d61608f5684f”,
“datatype”: “free-form”,
“data”: {
"RelatedItem": {
"Id": "72c824d5-3f46-4bd6-9bc3-60a2b5359ceb",
"Kind": "c9ddc944-fb27-4e34-88f8-76023fcc9ce9",
"Name": null
},
"Action": "updated"
}
},…
My question is why is the structure from these 2 protocols different.
I also noticed from the server logs that’s there’s another websocket endpoint that’s exposed : /api/ws/messages/v1
Is there any functions for this endpoint?
Also, if i would like to receive alarms through the websocket api, is there a websocket endpoint for that?



