I am working on an iOS application which allows users to share PDFs with other devices locally. When the application launches the device actively becomes a client searching for servers who are broadcasting files. When the client sees a server it adds a badge to its tab and adds an entry to it's table.
The problem I am having is the GKSession only allows for one string to be transmitted before the connection is established -The peer Display Name. What I would like to transmit is the file name, number of pages and maybe a thumbnail.
The only way I can currently think of to achieve this behaviour is to automatically connect the client and servers, exchange the file information and then automatically disconnect them. This may work well if there is only one or two files currently broadcasting, there is likely to be threading/synchronisation issues when lots of different devices are broadcasting.
For example 7 files may be available. So the client would have to connect to them one by one in order to receive information for all the files. This is likely to take a fair amount of time and the user may have already decided that they wish to download 'file 1'. By tapping 'file 1' a connection should be made and the transfer should begin. This may not be able to happen instantly if the client is busy retrieving information about the other available files.
I have also read some issues with connecting to a server again shortly after disconnecting from it.. (what GKSession doesn't connect on every attempt?).
So I guess it boils down to the simple questions - Does anyone have any ideas how I could allow the client to receive additional information about the server other than just the peerID and peerName?