What is the chat component in Pacifica app?

I am migrating my app to ionic 1 and I was looking into the show case section and noticed that Pacifica app has a great in-app chat feature.

I tried it out and it is responsive and has native-like feel and I am wondering what component or plugin did they use for the chat feature?

Any help would be much appreciated :slight_smile:

Note: you can find the Pacifica app here: http://showcase.ionicframework.com/

Hi, I actually built that :slight_smile: We use websockets for real-time communication with our servers, which just speak JSON with the mobile app. On the backend, we use Dropwizard, which is a Jetty-based Java server. The real-time chat communication is broadcast between our servers using Akka so that everyone receives it (we have a redundant, load-balanced setup).

So, for example, a user posts a new message in the chat group, which uses a regular HTTP POST to get to our server (it could use a websocket here as well, but we originally did not have real-time chat and just kept the HTTP POST). In the simple case, Server 1 could just look at all of the users connected to that particular group using a local map. That map might hold the websocket they are currently connected to. The server would then send the message to all users in the group via the websocket, excluding the original poster.

In our case we use Akka for pub-sub on that particular server. An object associated with the websocket registers for messages for that particular group. When Server 1 receives the message, it sends it down the websocket to all connected users, again, other than the original poster. In addition, Akka broadcasts that message over to Server 2 via a similar pub-sub mechanism. Server 2 receives it as if it was a message from the originating user, and the local pub-sub mechanism on Server 2 broadcasts it to all users connected to that server.

Note that, with websockets and load-balancing, things have to work this way because a websocket that is created against a particular server must remain connected to that server. If the servers don’t listen to each other, all users connected to the other server would not receive the message.

Bonus info: when a user starts typing we send a different type of message up to the server (this actually uses the websocket). The server broadcasts this over to the second server, and keeps track of which users are actively typing. Each server broadcasts another type of message to all connected users when the total number of users typing goes from 0 to 1 or >1 to 0.

Hope that helps. Happy to answer any questions you might have.


1 Like

Thanks for your replay :slight_smile: