GBM Challenge Websocket server
A microservice that consumes messages from rabbitmq and publishes them to
clients via websockets.
The counterpart for this service that must be run in conjunction with this one
to get a fully functioning setup can be found
here.
Features
- Two way communication between client and server through websockets
- Consume location information per ride
- Connect multiple clients to same ride location stream
Requirements
Usage
Go get the repository
go get bitbucket.org/jrlangford/gbm-challenge-wsserver
Build the binary
cd $GOPATH/bitbucket.org/jrlangford/gbm-challenge-wsserver
go get
go build
Build example clients
Follow the instructions on the example client README.md
Run the system
Run the server
./gbm-challenge-wsserver
This will launch the server listening, by default, on 'localhost:8090'
Run multiple example clients
./examples/client --ride_tag <ride_tag>
API
Ride
GET websocket
URI: /api/v0/connect/<ride_tag
>
Opens a websocket connection between the client and the server and starts
consuming data from the rabbitmq exchange marked with ride_tag
.
Troubleshooting
In case any errors appear in the websocket server log, restart the server and
reconnect clients
Potential improvements
- Extensive testing
- User authentication via oauth
- Definition of Lightweight communications protocol oer websockets
- User authentication via oauth
- Extensive input validation
- HTTP header setting and validation
- Dependency management
- Avoid go routine leakage