Is there a way in SmartApps where we can subscribe to a third-party API and update the changes in the state of a device in real-time instead of polling in certain intervals ?
You can subscribe to the change of state (or attribute) for a device.
Subscribing to changes in state or attribute can be done to devices in local network and devices which work on zigbee and zwave.
I wanted to subscribe to Rest API of third party server
You can’t “subscribe” to a REST-API 3rd party web service unless SmartThings handles asynchronous results. Well… I think does; but you’ll have to Read the Fancy Manual!
The other way is to give the 3rd party services your SmartApp’s callback URL with an Access Token. That’s also documented on web services SmartApps in the Docs.
Please read the docs. Please…