Skip to content

Real time communication (chatting, data transfer etc) among devices (clients) connected to a central mobile (server). In this way a PAN (Personal Area Network) is set up. No internet is required at all.

Notifications You must be signed in to change notification settings

AqibMukhtar/Real-time-communication-among-devices-without-internet

Repository files navigation

Real time communication among devices without internet

In the name of Allah, the Most Gracious, the most Merciful

Topics

  1. Introduction

    • Objective
    • Client-Server architecture
    • Network
  2. Setting up Node.js server in mobile

  3. Creating connections among devices

Content

1. Introduction:

Objective:

To create a small network of different devices that allows real time communication without using internet.

Client-Server architecture:

Client-Server architecture is the architecture followed by all websites. It may be 2 tier or 3 tier. In our case there is no database therefore the architecture is 2 tier. In the architecture, a device (client) requests some data from another device (server). The server sends the response based on the request from client. The server is capable of handling multiple requests from different clients, processing and sending the response. The restriction here is that server cannot send the response until a request is generated by client. In real-time applications (like chat apps) the server needs to send data to client/s without request of that client/s. This problem is solved by web-sockets, where a server can send data to client/s without the request. In my case, Nodejs is used as a server. For web sockets Sockets.IO is used.

Network:

In our this is not mentioned that either laptop/computer will be available or not. There mobile phone is selected as server. The mobile is configured with Nodejs. The other devices(clients) can connect to server by using hotspot provided by server. In this way server also acts as default gateway for clients. Any client can generate request to server by using server's IP address. The default IP address for hotspot is 192.168.43.1

2. Setting up Node.js server in mobile

To setup nodejs server, we first need to install Dory in our mobile. This application enables Nodejs server to run on android operating system. It also comes with git and SSH. Download it from here:

https://play.google.com/store/apps/details?id=io.tempage.dorynode&hl=en

Give Dory system permissions(storage) and install latest version of Nodejs according to android version. Now clone the JavaScript code from this repository into your mobile.

https://github.com/AqibMukhtar/Real-time-communication-among-devices-without-internet.git

The mobile is now able to act as a server with web sockets configured. For demonstration watch this video:

https://www.youtube.com/watch?v=DUNUOEwqKOU&list=UU4ct7ybFi5dGzRZwGLDEGmA

3. Creating connections among devices

Open hotspot in your mobile and connect required devices with it. To generate the and/or receive the response visit URL from your browser

http://192.168.43.1:3000

3000 is the port defined in JavaScript code. You can change it as per your need. For demonstration watch this video:

https://www.youtube.com/watch?v=4ZUQ6ZyYSQo&list=UU4ct7ybFi5dGzRZwGLDEGmA&index=2

ENJOY

👍

JazakAllah

About

Real time communication (chatting, data transfer etc) among devices (clients) connected to a central mobile (server). In this way a PAN (Personal Area Network) is set up. No internet is required at all.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages