Joke Collection Website - Blessing messages - Short message development

Short message development

In the back-end design of app, services such as message push, SMS and email are inevitable. Let's talk about this problem from the perspective of personal development experience.

(1) The most important thing is that all kinds of pushes must be processed in the queue system, otherwise the response time of the api will be seriously affected.

2 SMS.

In the past, we used the short message service of Yimei Softcom, but after the three major operators tightened the short message service, the short message delay of Yimei Softcom was very serious. Later, we found this short message service provider, and soon sent short messages to China Unicom, China Telecom and mobile phones (until 20 14+0.24).

If the SMS sent to the mobile phone is not improved, the last backup plan: send it to China Unicom, and the SMS sent to the mobile phone will use domestic service providers, while the SMS sent to the mobile phone can only use foreign SMS service providers (it costs 30 cents to send SMS to the mobile phone abroad, which is so expensive! ! ! )

Note: sharesdk now provides free SMS verification code service (/sms). During the trial operation, it will provide developers with free SMS verification for each App 10000 times a day.

(3) mail

At first, we used the server's own postfix to send mail, but we found that the mail was regarded as spam by many mail service providers, and there was no resending mechanism to ensure the accurate arrival of the mail.

Later, I checked the major websites and found that both Zhihu and github use /email service. After reading the document, the price is very reasonable, and there are 10000 free emails every month, which is very suitable for entrepreneurial companies.

④ Push service

In this regard, the focus of my consideration is: at the beginning of my business, I can use the services of third parties as much as possible, and I only deal with the business logic itself and develop products quickly.

Android article:

On the android side, we use three message push mechanisms:

1. Aurora Push, now give up. In the process of using it, we found that the mechanism of Aurora is a bit strange. Generally speaking, an app has a fixed id in the Aurora server, but in Aurora, the id of the app is notified by broadcasting, and it is actually stated in the document that the id will change from time to time.

2.openfire server. App gets all kinds of messages by connecting to openfire server, but openfire has a mechanism. When the app is connected to openfire, it will automatically disconnect when it is idle, so it cannot maintain the stability of the connection. The cost of modifying this openfire mechanism was too high, and openfire was later abandoned.

3. Baidu push. It has been used for some time now, and the push is timely and fast. I am quite satisfied with Baidu's push service.

Iphone article:

Apns is the best choice for iphone push. However, if you develop apns service yourself, you will encounter invalid tokens and need to resend them. In this way, you need to maintain a queue and establish a retransmission mechanism. Considering the project time and research and development cost, you will eventually use the service pushed by Baidu.

When the user uninstalls the application on the iphone, the device token will be invalid, so you should visit Apple's feedback server regularly to delete the invalid token.