- Notifications
You must be signed in to change notification settings - Fork1
udaychy/ChatRoomDemo
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a demo to show how offline app can be made simply withJsStore.
In Chat Room Demo, The messages sent or received are stored locally in indexedDB usingJsStore and synced with the server in each request.
If the user is offline or server is not responding, the messages are stored locally and these failed messages are pushed to server andnew messages are fetched from the server whenever user goes online or server starts responding.
Two new things are introduced in this demo which you should know:
JsStore:It is an IndexedDB Wrapper. It makes IndexedDB super easy with its SQL like apis.
Json-server:It provides API for CRUD operation on any json file(say db.json) which contains the data(like a Database) It run on node.js.
If node.js is not installed in your system then you can get it fromhere.
Open the Node.js command prompt and go to the directory(ChatRoomDemo) which containspackage.json
filethen enter the command below
$ npm install
This command will install the required modules for this demo.
Open the Node.js command prompt and go to the directory(ChatRoomDemo) which contains thedb.json
file. Once you are pointing to the ChatRoomDemo directory in Node.js command prompt, enter the command below
$ npm start
The site will be hosted athttp://localhost:8080.Now you can start playing with this demo by going offline and online from theNetwork
tab of Browser Developer tool