Android – connect the client to the server in a chat application such as Viber or telegraph
I want to create an application like Viber or WhatsApp. My main challenge is to connect the client and server. Now I know that I must use the WebSockets standard to connect. For the web client, I want to use the standard WebSockets. For Android and IOS, I will use the WebSockets based library. For example, You can see an example here: http://www.elabs.se/blog/66-using-websockets-in-native-ios-and-android-apps
Is this method right for this purpose? Are there any other options? For example, how does Viber or telegraph face this problem? Please help me choose the right method before starting. I will have three clients: Web, Android and IOS
resolvent:
Yes, this is the correct method. If you want to maintain a persistent connection with the server, you need to use WebSockets, which is very important for chat applications. You can try to use a third-party library that provides websocket functionality, such as socketrocket( https://github.com/square/SocketRocket )
As an alternative, you can also try something like pepper talk( https://github.com/Espreccino/PepperTalkSDK-iOS )This third-party chat SDK provides complete chat functions, including web sockets, notifications, UI, etc. out of the box
Disclaimer: I am the co-founder of pepper talk