I want to create an application like Viber or WhatsApp etc. My main challenge is connecting clients and server. Right now what i know that i have to use Websockets standard for connections. For web client i want to use standard Websockets and for Android and iOS i will use libraries for them based on Websockets. For example here you can see an example: http://www.elabs.se/blog/66-using-websockets-in-native-ios-and-android-apps
is this approach for this purpose is right? Whats other alternatives? For example Viber or Telegram how face this issue? Please help me to choose right approach before start. I will have 3 clients: Web, Android, iOS
Servers. As with most instant messaging protocols, Telegram uses centralized servers. Telegram Messenger LLP has servers in a number of countries throughout the world to improve the response time of their service. Telegram's server-side software is closed-source and proprietary.
Implementation of the websocket transport is pretty much the same as with TCP: a websocket connection is established to the chosen MTProto server over port 80 using the specified URI format.
Telegram has over 700 million monthly active users and is one of the 10 most downloaded apps in the world. With Telegram, you can send messages, photos, videos and files of any type (doc, zip, mp3, etc), as well as create groups for up to 200,000 people or channels for broadcasting to unlimited audiences.
Whatsapp uses TCP 443 (HTTPS) to pass the majority of the connection traffic but it also uses TCP 80 (HTTP). If voice is used, then ports 4244, 5222, 5223, 5228,50318, 59234 & 5242 are used. UDP Ports: 34784, 45395, 50318, 59234.
Yes, this is the right approach. You will need to use websockets if you want to maintain a persistent connection with the server, which is essential to a chat app. You can try out using 3rd party libraries which offer webSocket functionality like SocketRocket(https://github.com/square/SocketRocket)
As an alternative, you can also try using a 3rd party chat SDK like Pepper Talk (https://github.com/Espreccino/PepperTalkSDK-iOS) which offers complete chat functionality including web sockets, notifications, UI etc out of box.
Disclaimer: I am co-founder of Pepper Talk.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With