This is the Client side application ran on the beacons used by the ping project. It is a node.js server application which will be used as websocket client for the server application, found in the repo ping-master.
This repo features:
- Receiving files, and store them to the storage or storage/temp folder.
- Getting files from the filesystem and upload it to the socket.
- Deleting files.
- Executing commands on the beacon.
- Return the serial number of the raspberry pi as identification of the beacon for the master project.
- Return the git version number.
- Executing python commands on the beacon.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system eg the beacons.
What things you need to install the software and how to install them
- Node.js
- NPM (installed with Node.js)
- Common sense ;)
A step by step series of examples that tell you how to get a development env running. There is not a lot into it.
####Project setup
npm install
this uses nodemon
npm run serve
First setup a wifi connection to connect with
https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md
Then enable ssh
https://www.raspberrypi.org/documentation/remote-access/ssh/
Then run installation guide
Then next part is pointed at the installation of node, this is also present in install.sh
set the environment to production
NODE_ENV=production
copy the env variable and edit it if the configuration does not meet the current system
cp .env.example .env
# optional if the configuration does not meet the current system
nano .env
install the packages
npm install
run on production, the & is to run it in the background
node src/index.js &
here we will not assume you use pm2, if you do use it, forget the commands fg and node src/index.js &
fg
# then type CTRL+C
git pull
git reset HEAD --hard
npm install
node src/index.js &
pm2 stopzetten om te testen: sudo pm2 stop index
Git directory: cd /root/ping-slave
Python directory: cd /root/ping-slave/python
python (2.7) executen vanuit een los terminal window python ping.py
python stoppen vanuit een ander terminal window pkill -f ping.py
s,../storage/audio/Ab/ab.wav,0.05 i,../storage/lichtbeeld/8.jpg,2 e,statusoff e,statuson
- Node.js - The server framework used
- socket.io-client - Socket.io client. The client version for the websockets
- Friso Modderman - 404 solutions - Developer & Node.js - adminfriso
- Gijs van Bon - van Bon - Artist & Python - GvBon