Made Chat for BST Consulting

In this article, we will talk about what chats and instant messengers are.

In this case, we created a chat for the consulting company BST Consulting , which offers its users online lessons. We have also developed the entire tutorial project, but in this article we are only focusing on the chat.

Chat is a means of exchanging messages over a computer network in real time, as well as software that allows you to organize such communication. A characteristic feature is communication in real time or close to this, which distinguishes chat from forums and other "slow" means, such as messaging by e-mail.

All the magic of messaging is provided by AJAX technology and the implementation of special “events” using Javascript. We wrote more about Javascript and Front End earlier.

AJAX (abbreviation for "Asynchronous Javascript And Xml") is a technology for accessing the server without reloading the page.

Examples of using AJAX in applications and websites:

  • When adding a product to the cart, your page does not reload, while the added product appears in it;
  • Correspondence in a messenger, for example Telegram. You send a message to the interlocutor and he receives it in the same second and without reloading the page.
  • Entering a word in a Google search engine and issuing similar options and without the need to refresh the page.

An “event” is a signal from the browser that something has happened. In the context of a chat, for example, we see the status “prints a message” from the interlocutor at the moment when he types a message to you in response. Processing of such an action is implemented using prepared functions in Javascript, which must be linked to the Front End of the project and the Back End.

Highly loaded messengers like Telegram, Viber use server requests with a frequency of 20-30 milliseconds to receive an instant response from the interlocutor. Such an algorithm is justified for the convenient use of the program, but it loads the server capacity very heavily due to continuous requests.

Therefore, for BST Consulting, we deliberately limited the frequency of server requests to 10 seconds. Chat is not a key tool for this project and the frequency of use of the system is quite low. But if the number of users grows from 100 people per month to 10 thousand people / month, then we will reduce this request to 2 seconds and transfer the project to a more powerful server.