TCP Protocol Implementation
-
So I need to send data between a server and client over TCP inside a vehicle. Currently, I have the server up and running but just need to figure out the actual implementation of the data transfer. For the client I need to do the same and figure out how to render the QML correctly. Anyway, what would be a good way to pass data containing QML models or even data such as Artist, Song, and Album (think iPod menu) and then also pass data regarding the song currently playing (song updates like time playing, etc.).
Any ideas about a good way of implementing a protocol to handle this? Basically the center stack is the server and handles the logic while the cluster/client is just a view that renders QML. I was thinking about just passing QStringLists with model information and then dynamically swapping models within the view. Also, I need to send images over TCP while the song is playing for things like Album art.
Also, I need an effective way to cache these images and probably the models too, so the client doesn't need to make a request to the server on every menu switch. Again, think about how an iPod works and that's what I'm going for.
-
json or at a push xml over http would seem the obvious way to investigate.
-
Being that http is half-duplex how would the client and server speak back and forth? Basically the client would then just ask for Artist A's tracks and albums or for Album B's tracks and the server would return it as JSON or XML? But the server would never be able to request from the client, right? Which I think in my case, it doesn't need to.
Also, right now I have an event that fires each second that sends song data to the client. Can this be done over http easily in Qt? I'm going to guess that the answer is yes. Before I started all of this I assumed TCP was the way to go but it seems HTTP might be a better way.