It really depends on your requirements and if you really need a permanent connection or not.
If you have time-dependent data, you need to click from the server to the device as soon as it becomes available, then it will be better for you to maintain a constant TCP connection.
If itβs acceptable that your server and device only periodically exchange information, then choosing a poll or HTTP requests may be the best choice.
Personally, I believe that a well-implemented long-term TCP connection with a binary protocol is the best choice when working with persistent connections, where the information should always be up to date.
HTTP connections are usually expensive in terms of overhead for each packet, especially if you use an XML-based protocol such as SOAP. In addition, plugging and unplugging connectors all the time is usually quite expensive.
Permanent TCP connections, on the other hand, can be difficult to implement both on the client side and on the server side. Battery life is a huge factor on the device side, and if you expect something more than a few users connected right away, you may need to implement an asynchronous server-side communication model, which will cause your own set of problems.
Good luck
source share