This repository houses the Query It! experience.
##Important You need a valid Google Cloud Platform project to run this experience. Be aware, if you are not using a free trial, you will be charged for running the queries in this experience.
###Generate Cert Token
- Visit Credentials in GCP console
- Click Manage Service Accounts
- Create a new service account
- Create a directory named
cert
- Download certificate and rename it
service_account.json
. - Put
service_account.json
in the/cert
directory.
This project uses:
To run this locally you'll need to:
npm install
npm run dev
cd querysrv
node querysrv.js
To use Vagrant to run the stack:
cd deploy
vagrant up
vagrant ssh
cd /vagrant/
npm run dev
You may need to run Salt again to set everything up:
vagrant up
vagrant ssh
sudo salt-call --local state.highstate
##SocketTalk
To start the socket server, run node server.js
.
After running this server, you need to start the clients for both Player 1 and Player 2 (see below).
When input is entered either locally or through a Pi, the data that is sent to the server is in JSON format.
{
"running": "", // String for running answer, wiped down to an empty string when Enter is pressed
"submitted": boolean, // true if Enter button was pressed, false otherwise
"client": integer, // Should be either 1 or 2, depending on player identity
}
####Local
The inputs for Query It! are streamed through websockets.
Including an instance of SocketDebugger
(currently in app.js
), will allow you to enter input for either player. Simply typing will send input to Player 1, where holding shift and typing will send input to Player 2.
This functionality can also be tested with the client.js
app by running using the following command in a seperate Terminal window.
node client.js --host=localhost --port=8095 --id=1
Using --id=1
and --id=2
will input the query into either Player 1 or Player 2's field. Using neither will give a pipeline for playing all sounds for the experience.
If you have two extra windows open, you can run a version of both id
s and switch between them to closely approximate the game.
Remember that you have to type into the Terminal window, not the browser.
####Raspberry Pi
The Pis are currently configured to be on static IPs of 172.20.2.150
for Player 1 and 172.20.2.151
for Player 2. In order to update the computer that they automatically connect to on boot, you'll need to ssh in and change their boot address.
For example, if the computer running the experience has an address of 172.20.6.144
, follow these steps for the Player 1 Pi.
ssh pi@172.20.2.150
(use Pi default password)sudo nano /home/pi/www/client.shl
- Edit line 3 to read
/usr/bin/node /home/pi/www/client.js --host=172.20.6.144 --port=8095 --id=1
sudo reboot
Optionally, you can get the Pis to autostart the client.js
:
sudo nano ~/.config/lxsession/LXDE-pi/autostart
- Add
@lxterminal --command /home/pi/www/client.shl
Follow these steps for Player 2 Pi, only use ssh pi@172.20.2.151
and --id=2
.
It's not working propely