Demo Broadcast/Tracking location with SocketIO (like Uber/Grab) for Web/Mobile Apps
This project helps us show a demo app view all vehicles are moving on the maps. It’s useful to make a prototype app like Uber/Grab.
It’s not real tracking GPS. I use GPX files exported from Google Direction service to make a fake tracking engine and socketIO to emit data to the clients. Hope you enjoy it 😄
You must have node installed: Install NodeJS.
Clone repository and change directory to it
git clone https://github.com/viettranx/tracking-location-socketio.git
cd tracking-location-socketio/server
Install nodemon
npm install -g nodemon
Install all dependencies needed
npm install
This project needs nodemon to run and watch file changes. The command is:
nodemon Server.js
In case we need to run it as background service. Install forever and run:
npm install -g forever
forever start -c nodemon Server.js
Open your favorite browser and go to:
http://localhost:4333/
You can find default config in nodemon.json
. That’s just simple:
{
"env" : {
"RUN_MODE" : "dev",
"PORT" : 4333
}
}
Since the nodemon service could not watch itself config, you need to restart it.
This project uses GPX format to emit location info to the clients. Just place any file GPX to gpx
folder to add more. To create a GPX file, you can use Google Maps Direction service and export it with a shorten URL:
Then paste the URL to https://mapstogpx.com/pokemon.php to generate GPX file
You need react-native installed: React Native
Follow these steps to run the project:
cd client/react-native
npm install
react-native link
react-native run-android
As on iOS
cd client/react-native/ios
pod install
cd ..
react-native run-ios
Please note that socket.io in App.js
points to localhost:4333
. Modify it in case you need to change your server URL.
const socketURL = 'http://localhost:4333'
cd client/native-ios-swift/DemoTrackingLocation
pod install
open DemoTrackingLocation.xcworkspace
Open client/native-android-kotlin with your Android Studio (>= v.3). Hit Run button
and choose your simulator.
Feel free to use and pull request to contribute it as you want.