简体   繁体   中英

Sending friend request and adding friends in an iOS social network app using PHP?

Basically, I am now making a basic social network app on iOS platform, using PHP as the backend. I am be able to make the login, register functions in my social network app, however, I am now struggling how to add friend in my app.

As far as I know, I have to make a table for making_friends, just following this tutorial: http://www.9lessons.info/2014/03/facebook-style-friend-request-system.html

However, what I wonder is, if one user send a friend request to another user, then the "status" in the "making_friends" table maybe "0", to indicate that the friend request is sent and waiting for the reply. But how to let the other user know, that a user is sending a friend request to him, and then the other user may accept the friend request and updating the "status" to "1", which means the other user accepts the friend request.

In a word, I am not sure how to communicate from one client to another client, using server as a bridge. Does anyone have any good suggestions?

You can use push notification to send a request to a client or hit to server periodically and check the status but this is not a good way to handle it

For ios push notification check this Apple Push Notification Services

You can INSERT both users as one record in making_friends table and make a status for it.

 making_friends table
--------------------
User1
User2
Status

Once a user inserted in this table you can make a flag on status and let the user know the request

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM