web services or socket level communications
I'm working on a realtime system where I'm using an IOS device to control a piece of hardware. On the hardware side I have a Windows PC. I will be sending commands from the ios device to the hardware and I'm free to use whatever communication stack I see fit. Would you recommend using web serivces (JSON/HTTP) or low level socket communications. Networks performan开发者_如何学Cce is not an issue, but since telemetry is being send back and forth I was considering using a telnet type protocol. Thoughts?
Telnet type implies terminal conversion - I believe what you mean is raw socket communication.
If you are communicating bi-directionally, HTTP is not ideal. In addition, if you are frequently making requests or updating data, HTTP (in non-keep-alive) is not ideal either.
A raw socket is a great idea. The protocol can still be JSON (for ease of use/debugability). For instance, a JSON string can be sent - one data payload per \n
(newline) character, or even per \0
NULL character.
精彩评论