Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strategy for fast IOS contacts "friend finder" [closed]

Example:

  • Snapchat - Add Friends(from phone contacts)
  • Twitter - Find Friends(from phone contacts)

I have no problems extracting names, phone numbers, email addresses from the IOS device contacts. I have been experimenting with different approaches and strategies to:

  • Upload contacts to web server
  • Compare list with server database using phone numbers and email addresses (not necessary to store a copy)
  • Return a list of contacts who are also users and who are not

My attempts takes roughly 30-45 seconds for 500 contacts. The same set of contacts takes 2-5 seconds roughly for snapchat or twitter to work with.

What is their secret? Good obj-c coding? Good database design? I appreciate that they would have highly efficient hosting stacks but I wasn't expecting that kind of time difference.

Is it better to:

  1. Try a bulk upload of all contacts and return a json string with hits and misses.
  2. A single HTTP request for each?
  3. Opening some kind of persistent connection like a websocket to check each contact?
  4. Some other obvious strategy or approach I haven't considered yet?
like image 822
chabber Avatar asked Jan 26 '14 00:01

chabber


1 Answers

I think the key is to make the request smaller by utilizing a single piece of contact information for the search rather than using names, numbers, and email addresses. If your service requires any of those pieces for sign up, like the phone number, use just the phone number. When you return info from your server, don't send anything you don't need, like the phone numbers you couldn't find a match for.

Secondly, your option #3 isn't a bad idea if you have the technical know-how. I recommend a library called SocketRocket. It was developed by the people who make Square and makes implementing websockets on your front-end very easy.

I can't speak to your back end, but I use node.js and this package: https://github.com/einaros/ws Very easy to install (npm install ws) and also easy to use.

like image 134
dalton_c Avatar answered Oct 27 '22 00:10

dalton_c