mosquitto-users team mailing list archive
-
mosquitto-users team
-
Mailing list archive
-
Message #00031
Mosquitto+Python+MySQL+APNS
Hi,
I knew that Facebook used mosquitto in their messenger app on iPhone. and
it worked pretty well. Here is what they say:
http://www.facebook.com/notes/facebook-engineering/building-facebook-messenger/10150259350998920
I am considering using Mosquitto to implement a chat/messaging service for
my iPhone app as well. I am using Python to write the server side api. so i
am wondering is this this the proper way to do that:
1. set up a broker on the server side
2. using iPhone mosquitto client to connect to it
3. then different client can send message with each other (when they are
all online)
this works fine for some persistent signal monitoring system, but for
chatting experience on mobile, there are two challenges:
*Data Persistence*: I need the server to store all the messages in a
database for the record. so when people log in from anther phone or
reinstall the app, they can still check their message history. I am using
MySQL. I guess Facebook messenger also integrated database storage of
messages, otherwise how the system keep track of all the communication.
*APNS* (Apple Push Notification Service): imagine you are NOT using your
phone or playing another game app (i.e.: the chat app is either not
launched or non-active), your friend send you a message, then there should
be a way for the server to notify you. Apple's solution is
APNS<http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html>.
Again, it's based on the database and another service provider, which i
will build using python.
here are my questions:
1. what's the best practice to connect Mosquitto broker with the MySQL to
make sure: all messages are stored in the database? Ideally, all message
sent to server should be stored in the db *before *they are distributed, to
ensure the data security.
2. when the server know one client is not active/connected, the server
should call the APNS service to send the notice to the client. Should this
process happen in the API or from the broker?
3. for the iPhone wrapper of the mosquitto client, I checked
Marquette<https://github.com/njh/marquette/> ,
is this wrapper compatible with the latest version of Mosquitto 1.0.2
I know this is quite complicated issue, but really hope can get some advice
on how to approach.
thanks a lot!
-Horace
Follow ups