How to get real time Health updates from Apple watch, sync it with health kit and send it to server?

I am working on a iPhone application that consumes health kit data and sends the data to Server whenever i open the iPhone app.


My requirement is whenever there is any change in heart rate, step count etc. from apple Watch(even when watch is locked - black screen), the health kit in iPhone should be updated and the same should be sent to my server as well even when my iPhone app is in background or device is locked. Basically i am trying to send updates to server whenever there is a change in healthkit data. Is this even possible?


I followed this link HealthKit (iOS) won't deliver data in background (objC) to implement Observer Query to fetch heart rate from health kit and it is working only when i unlock the iPhone that too in some interval. I need to invoke this handler whenever there is any updates to healthkit data in watch app even when my iPhone app is in background or phone is locked.