To make sure that our server is runing go to the command line under our project directory and execute this command node index.js Res.send( 'Chat Server is running on port 3000')Ĭonsole.log( 'Node app is running on port 3000') Io = require( 'socket.io').listen(server) 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'), Ī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 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.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |