We will be learning to create a real time application by covering the following scenario. More in-depth info about the above three technologies can be read here. One can send a request to the server and receive event driven responses without Polling the server for a reply, making web sockets a best choice for our use case. Web Sockets: make it possible to open interactive communication between the client and server.After receiving it, the client sends another request, and needs additional header to be traversed back and forth causing additional overhead. Long Polling: Like AJAX, but the server holds on the response until it has an update.Short Polling: AJAX, creates heavy traffic.Technologies which can be used for realtime communication are: These all are the common scenarios of our day to day lives where we can’t tolerate a delay in the updating of information and hence need real time communication. Food order info update to the kitchen of your favourite restaurant.Getting new messages instantly on your favourite chatting application.Getting location updates for your cab on a map of a cab booking application.If you are curious about the above questions and need an answer, then this blog post is for you.įirst, let’s identify a few use cases needing real time applications: Now in our index.js file we will build our server and make all the configurations so that it will look like this const express = require('express'), http = require('http'), app = express(), server = http.createServer(app), io = require('socket.io').listen(server) app.Ever wondered how real time apps are built? Ever noticed the importance and use cases of real time applications? Īfter creating the two files, we open the commande line under our project directory and execute this command npm install -save express socket.io Package.json which will handle all the depandencies for our node js app and index.js which will be our main server. Well, to make things clear our project architecture will be composed of 2 files : In this article we will show you how to build a realtime chat app using android nodeJs and Socket.io Getting startedġ- Server side : a node js server with the implementation of socket.io for serverĢ- Client side : creating the android app and implementing socket.io for client Our NodeJs Server In fact this mechanism is so powerfull and it’s used to build different kind of apps like realtime chat or notification system etc. WebSockets are very beautiful tools that allows us to establish a realtime communication in modern web applications. Creating a realtime chat app with android, NodeJs and Socket.io Introduction
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |