Select leader depending on latency or such

I'm developing a web service that has a client and a server. The service allows groups of users to connect to each other using peer-to-peer. The service is pretty heavy on the bandwidth and every 30 seconds I want one user from each group to send an image to the server. As the service is already pretty heavy on the bandwidth, I would like to select a suiting leader. Either by perhaps pinging the server directly from the browser and check latency or by some other way.

Any ideas?