-1

I want to create a chat application. My chat application is properly working as a real time chat at web server using continuous polling and pushing data. But, Polling is not a good solution for mobile application. Since, Our whole chat is already built as HTTP Rest API so, moving to XMPP is a great deal for us.

So,We just came to know about WebSocket. Can anyone suggest me which is better for real time chat in this situation. WebSocket is very fast and we didn't need continuous timer polling from server also.

Do suggest better option if any and thanks :)

Srijan Kumar
  • 11
  • 1
  • 4

1 Answers1

0

One creation purpose of XMPP was instant messaging. It had a server on jabber.com, and also having possibility of setting up a server on your own due to its open source nature. But, XMPP is an XML based application protocol which will not allow you to do some specific customizations. Also possibly you will want to use websockets as transport protocol (except handshakes) for your XMPP for real-time messaging.

Since Websocket will make you to write your own app with some effort, you will get strength to design it as you wish.

You can use path decleration of websockets to declare different channels and broadcast incoming data to all connected users. Its up to you.

cagdas
  • 1,634
  • 2
  • 14
  • 27
  • Thanks, One more which is a very vital issue is battery draining. Would the same issue come in case of Web Socket for android and iOS application since there is a regular live connection between server and client and frequent disconnection may increases bandwidth resulting increase of battery consumption. Any solution for this. – Srijan Kumar Jan 05 '17 at 09:27
  • Actually websockets are not designed for battery oriented devices. You can take a look at mqtt or coap for minified format of data frames. Mqtt allows qos where you cant apply in websockets without external checks. – cagdas Jan 05 '17 at 18:42
  • Oops, I was supposed to start with Web Socket.But, there are a lot apps which are using Web Socket in mobile application. Slack is one of the example.I don't have a good idea about MQTT. Would I need to do work at server side also for MQTT. – Srijan Kumar Jan 06 '17 at 04:57
  • Ok, i understand, you mean mobile device battery. I thought you mean an unchargable device. Of course, websocket is good choice for mobile devs. Maybe you want to check socket.io for incremented feature set of websockets on server and mobile side. They already have an instant messaging example. – cagdas Jan 06 '17 at 06:05
  • Yes, I was also asking the same, Which is a better choice for mobile device. XMPP, MQTT or Web Socket. I have to make my own UI for clients in more configurable way. I researched many aspects and came to solution with Web Socket.XMPP is also good but has a lot battery related glitches for mobile devices. Thanks a lot Sir for all your advice :) – Srijan Kumar Jan 06 '17 at 06:18
  • MQTT provides ightweight publish and subscribe method with its broker instead of server. But it has no widespread use for this kind of applications. My vote is for socket.io which has official libraries for mobile and web clients. – cagdas Jan 06 '17 at 08:04
  • Thanks. We are going for socket.io. It's chat client is very fine and robust. – Srijan Kumar Jan 06 '17 at 08:05