The Sensor Client will run on the Raspberry PI and will expose a Websocket endpoint for the aggregator service to obtain the sensor readings and subsequently send them to the Game Controller.
Run the sensor client:
go run *.go
The Docker image for the Sensor Client is located in Docker hub. To get the image just run docker pull emccode/mars-challenge-client.
In the following case we are going to listen on the port 80 on our host machine that will bind to the container's exposed port 8080.
docker run -d --name=sensor -p 80:8080 emccode/mars-challenge-client
The game controller has the following dependencies:
go get github.com/gorilla/muxgo get github.com/gorilla/websocketsThe websocket endpoint is located in /ws. It sends the following JSON structure every second corresponding to the Sensor data.
| Field | Description |
|---|---|
solarFlare | Whether there is a solar flare or not. Values are either true or false |
temperature | Float value ranging from -142 to 35 representing the current temperature in Celsius. |
radiation | Integer value ranging from 0 to 1000. |
The endpoint in / (root) contains a basic Javascript client that connects to the Websocket endpoint.
Content type
Image
Digest
sha256:9e2433e03…
Size
308.1 MB
Last updated
over 10 years ago
docker pull emccode/mars-challenge-client