JavaScript È°¿ëÆÁ
2018.06.29 / 21:20

What is the best framework to develop a real-time chat application

aichatbot
Ãßõ ¼ö 182

What is the best framework to develop a real-time chat application, considering scaling, time to market, etc.? I started off using Ruby on Rails with Faye, but I am now thinking about switching to an entirely JavaScript based framework.

12 Answers
Ben Smiley

Broadly speaking there are three options to make a real-time chat application.

  1. Custom server
  2. XMPP
  3. Real-time backend service

I¡¯ll give you a quick summary of the options and their strengths and weaknesses:

Custom server

The first question would be whether you should develop your own messaging backend. I would recommend developing it yourself if any of the following are true.

  1. You are curious about how to implement a messaging server
  2. You have some particular requirements that would rule out other existing options
  3. You are confident that your app will need to scale aggressively and have the budget to design the messaging implementation with that in mind

I would recommend against building a custom server if:

  1. You want to release your product quickly
  2. You have a small team and / or a small budget
  3. You don¡¯t have prior instant messaging experience

Assuming that you do still want to build a custom server, I would recommend using Symfony with the WebSockets bundle. I like Symfony because it has such a clean, logical structure and makes development very easy.

XMPP

The next option would be to use an existing messaging server. This would save you a lot of time and effort. There are a number of great open source messaging servers available:

And some very comprehensive client frameworks: XMPPFrameworkSmack.

There are several benefits to using an existing server:

  1. You will be inheriting a large, well tested code base which will mean you won¡¯t have to spend time re-implementing features
  2. The servers have been proven to scale well
  3. You could release an MVP much more quickly

You could invest the time you would have spent developing the server, learning how to build modules for one of the existing frameworks and get the best of both worlds.

Real-time backend

The final option is to use a real-time backend service. This would be by far the quickest option of the three. It also takes all the pain out of scaling because all the server configuration is taken care of.

In this case, I would recommend Firebase coupled with the Firebase Chat SDK. Within a day you could have fully functional messaging clients up and running for iOS and Android with the ability to scale to hundreds of thousands of daily users.

Then you could spend your time integrating your server with the Firebase REST API and modifying the client apps to meet your needs.

Simon Andrews

I work for a bespoke app design company which specialises in instant messaging. We have been working on chat solutions for the last 5+ years.

We have recently released open source, compatible, chat components for iOS and Android to Github. These have been released on an MIT license meaning you can download and modify the code without obligation to use.

I would recommend this framework for a number of reasons:

  • Flexibility: When using ChatSDK you download the complete code and add it to you project. This means you have complete control of the chat features and can modify or add features at your own discretion. Using a set chat API will often lock you in to their functions and features making it difficult to modify.
  • Licensing: You should always check the license a framework is released on. MIT and BSD licenses allow you to use the code for whatever you want without obligation to the code writers. Other licenses might be initially free but can place restrictions on you once you release the code to market. There are even chat frameworks which license allows them to access and sell your user data.
  • Cost: ChatSDK is a free fully functionality chat component. This is great for developers and businesses alike as you can quickly get a version of chat added to your application.
  • Support: We fully support our chat components and also have the advantage of having a Github community around the ChatSDK. This means there are other users who can release new features, find bugs and help improve the chat.
  • Documentation: We provide complete documentation for setting up and adding the chat to your project.

This includes all the standard features you¡¯d expect from a chat component:

  • Multiple login types (Facebook, Twitter, email/password, anonymous)
  • Multiple message types (text, image and location)
  • Custom user profiles (set user profile image, name, email, phone)
  • Flexible user search (search by name, phone, email etc)
  • Multiple chat types (1-to-1, private group and public forum)
  • Adaptive chat screen with interactive messaging bubbles
  • Checkout a complete list here.

The ChatSDK is a great way to quickly add messaging to your application without tying yourself into a API which could have hidden limitations once you go to release your app.

Jennifer Nilsson

Application market grows day by day and people are in need of numerous applications affecting their lives. No wonder app development becomes very trendy. Therefore, it is important to deal with the best and easy tools having the required range of functionalities. The same concerns the development frameworks.

Nowadays we may choose between three of them:

1. Backbone JS

2. Node.js

3. AngularJS

Let¡¯s consider the main features of each.

BACKBONE JS

Backbone.js is the uber-light weight Javascript framework designed to structurate Java code to simplify its operating. It depends only on Underscore plus JQuery JavaScript libraries. With the usage of RESTful JSON interface it helps to reach modelviewcontroller (MVC) application design format.

  • Model – consists of code of application data.
  • View – holds data that is used to represent into HTML view.
  • Controller – simplified relation code model and its HTML view. Also, it allows a programmer to save Javascript app state with simple hashbang in the URL.

Developers are using Backbone.js to make one page web applications and to keep different parts of it structures (such as clients and servers). Models created with Backbone.js may easily integrate in any backend.

Many of web applications use backbone.js. But we will show only the best backbone apps that you might already used or heard about for sure.

Best Backbone js apps are:

¡¤ Trello

¡¤ Pandora internet radio

¡¤ USA today

¡¤ SoundCloud mobile

¡¤ Wordpress.com

NODE.JS

Node.js is a runtime environment. It is an open-source JavaScript for network applications building. It allows developers to execute the code on the server side. Meaning: on own computer or straight in a browser. Therefore, Node.js is light, scalable and fast way to write scripts. It allows and unifies app development, removing the need for different languages. Node.js is mainly in use to create web applications in real-time but mobile app development is also possible.

With Node.js you are able to use the code or scripts that have been written in other languages, as well.

Microsoft, IBM, Cisco, Netflix, PayPal¡¦These are just few of top companies using node.js software for their products. Since initial release in 2009 this JavaScript environment has gained huge attraction. Node.js applications are written in JavaScript, and they can run within the Node.js runtime on OS X, Microsoft Windows, and Linux. It is known to be very comfortable to use having the following advantages:

¡¤ it is light, scalable and fast way to write script allowing the developers to carry out the code on the server side, i.e.: on own computer or straight in a browser;

¡¤ it allows and unifies app development, removing the need for different languages;

¡¤ node.js is uses to create web applications in real-time;

¡¤ provides possibility for mobile app development;

¡¤ allows using the code or scripts that have been written in other languages.

Now, here are best Node.js projects examples:

¡¤ PayPal and Node.js

¡¤ Netflix and Node.js

¡¤ Uber and Node.js

¡¤ LinkedIn and Node.js

¡¤ Ebay and Node.js

Node.js has a terrific helper tool – Garbage Collector. It manages application¡¯s memory and prevents memory leaks. Thus, main gains of Node.js apps are:

  • speed (runs on google JS engine)
  • non-blocking I/O paradigm
  • data streaming (HTTP requests and responses as a single event)
  • real-time apps (client-side and server-side)
  • unified database queries (JSON format)
  • easy and fast coding
  • open-source NPM repository (over 60.000 modules)
  • proxy server ability
  • fast development cycles
  • business logic on the server
  • appropriate for android devices

ANGULARJS

You can find the AngularJS apps examples everywhere around the internet. No wonder, because since it released in 2009, till now it is one of the most popular framework around the internet.

AngularJS is an excellent front-end JavaScript framework for building one-page web applications. In addition, to the rich standard library, it offers a bunch of custom extensions. Moreover, it has huge community and a Core.

AngularJS, it is very popular and robust framework with open source code for web applications that consist of one HTML-pages with CSS JavaScript named (SPAs). In fact, AngularJS is monolithic frameworks which include these three paradigms: Models, Views and Controllers, as we all known as MVC design patern. But Angular developers say that it actually isn¡¯t MVC and more looks like MV*. And perfectly, in our opinion, is coming to developments regarding small and medium projects.

Main advantages of AngularJS re:

¡¤ perfect documentation

¡¤ big community

¡¤ 2-Way data binding, which simplify some processes

¡¤ good HTML debugging

¡¤ quick scaffold and develop small and middle projects

Best AngularJS examples are as follows:

¡¤ PayPal

¡¤ Netflix

¡¤ Weather

¡¤ The Guardian

¡¤ Lego

AngularJS really is a full framework. You should use AngularJS if you plan to carry a lot of unit tests during development and you want a comprehensive solution for your application.

Well, each approach to building application architecture has its own advantages and disadvantages, and the choice is up to you, you can make based on the requirements of your project.

Paul Stephen Borile

I would approach the problem taking a step back :

  1. Growth Requirements : how big it is, much does it have to scale ?
    1. Are you planning a world wide consumer chat service which will have millions of users, android and ios apps, a web interface, api for developers ?
    2. Is it going to be an enterprise product which runs inside an existing application adding chat features ?
    3. Is the chat feature a fundamental company value/asset ?
  2. Make or Buy : Knowing this info (point 1) will definitely resolve the make_or_buy dilemma (for example if c is true then you will tend to make your own infrastructure).
  3. Define User Interfaces : how are the users going to use the Chat service ? You server infrastructure is there to serve client applications the best possible way so I would suggest to design it with the dev environment which bests suits the type of service your are giving :
    1. Ios/Android Apps ? Provide app builders a server REST API with all features
    2. Web Interface ? You might use a js framework and again call a server REST API interface
    3. Open API for customers : your already have your server REST API
  4. Server Architecture : depending on 1. you might choose to use microservice architecture (or SOA o monolith) and a full set of tools available : here an always incomplete list Microservices technology map

So you will end up having some more details of what you want to build : only now you may decide client and server technology. Of course those are only a few constraints you might have : in some cases ¡°time to market¡± becomes important, ¡°need for an MVP¡± too.

Devashish Datt Mamgain

If you are looking for "Customer communication" then check Human+Bot Hybrid Customer Support Software

If you are looking to enable a white labelled "user to user" chat within your application where users can do one to one chat then give a try to Applozic Chat & Messaging SDK.

Applozic lets companies embed chat/messaging capabilities into their mobile apps and website without developing or maintaining any infrastructure.

It supports Android, iOS and web platforms and can you fully customize the UI based on the design, the end user will not be able to figure out if its Applozic running inside.

PS: I am the cofounder of Applozic

Jonathan Maim

From my personal experience, I would agree with your comment and say that a full stack JavaScript approach is best as it means you code in the same language everywhere: no time-consuming context switches. If you decide to go down that route, you can find a list of the most popular JavaScript libraries and frameworks to build chat applications here. The list is divided into 3 categories: front-end libraries, back-end solutions, and frameworks that allow to manage both at once.

That being said, if you¡¯re building your app from scratch, and intend to work on it for a long time, it¡¯s always best to opt for the languages and frameworks you are the most comfortable with.

Ozan Can Köseley

In-app messaging is one of the best tool to provide customer support. It makes possible to gather user feedback and provide proactive customer support. Interaction via messaging within your users in your app will definitely increase app retention.

Jetlink makes it easy to access FAQs so that mobile users can find answers even before they reach out to you. Jetlink FAQs makes it easy to update content in minutes without any hard coding in your mobile app.

Jetlink¡¯s ready in app messaging SDK¡¯s are easy to implement & low cost to use. You can see more on our Github account

Besides, it looks native in your app and provide the best messaging experience for your users. It is not a pop-up screen or widget, it gives the feeling of a native partof your mobile app.

Video shows how to implement our SDK¡¦

Here is an example app screen Jetlink SDK is implemented¡¦

Máté Marschalkó
Socket.IO is definitely what you are looking for. It's a Node.js library running on the server that can connect multiple browsers and users together using Web Sockets.

You will be able to build a quick live chat demo in an hour if you follow their tutorial:
Socket.IO - Chat

I actually used this library for two of my Arduino microcontroller projects:
Arduino Node.js RC Car Driven with the HTML5 Gamepad API - Web on Devices

The Arduino Plant with JavaScript voice recognition - Web on Devices
I have created Chat Clients and Servers in Java and it's quite nice as the networking libraries are quite easily available and well documented. 
However, in terms of scalability and load factor I would not recommend it. 

The best language to create a Client/Server model for a Chat Application would be using http://nodejs.org/ . It's the perfect choice for this kind of application. From your question I gather you know Javascript,hence you won't have a problem learning Nodejs. It already has a demo of the ChatServer which you can try at http://chat.nodejs.org/ . Also as you wish to create Mobile Apps I would recommend looking at HTML5 for creating this app as it would be ideal in your case.
Joshua Schoenaker

Check out TalkJS. Chat API and Javascript SDK for websites and apps.

Don't reinvent the wheel. Our chat API + SDK allows developers to easily add chat between users on your platform in hours instead of months.

Thanks!

Andrei Soroker
Check out Layer - https://layer.com/

They are early, but conceptually it's exactly what you want: a framework for live chat application.
Try Jiver SDK - http://jiver.io
1:1 messaging all the way up to large-scale chat rooms for your app or game.
Super easy and fast.