Taxi


Where it is and how it works

The deployed site is: https://taxi.darbelis.eu

Project source: https://github.com/kukulis/taxi, implemented with Go

In the current version this project doesn't use any database, all Drivers and Passengers data stored in the operating memory

The idea is to help passenger find a driver who can carry him where ever he wants.

When you connect to the site you select who you are, driver or passenger.

If you are driver, you may want to go to 'Idle' state by selecting it in GUI; if you do that you become visible to passengers.

Another person who is passenger, searches nearby driver from 250 meters, 500 meters, 1 kilometer or 5 kilometers range. If there is any, it becomes visible to passenger.

Then passenger may invite driver, by pressing 'invite' button.

Driver receives invitation and sees coordinates. He then may accept the invitation by pressing 'accept' or reject it by pressing 'reject'. If he accepts the invitation, passenger sees that invitation is accepted and waits until driver arrives to him.

When passenger enters a car, driver presses button 'working' and the invitation goes to a 'driving' stage.

When voyage is finished, driver enters 'resting' or 'idle' state, and the invitation becomes 'complete'

Technical details

The functionality is simple and actually unfinished as humans does not read coordinates, but street addresses

Transforming from coordinates to address and vice versus is called 'Geocoding'. So This project is lacking geocoding functionality.

Project is implemented in Go language, and uses WebSockets to communicate between client and server.

Challenging part was designing of messages protocol, how information is transfered between client and server.

Websockets allows to instantly react to the incomming information from server to client. If client sends or requests some information from server, he does not get answer in a synchronows way, but has as messages listener function that works Asyncrhonuosly from his messages. So driver does not need to periodicaly request server if there are any passengers willing to travel, but just listens websocket channel. When user send offer to him, it is retransferred from server to driver faster than in a second.

Listening weboscket almost requires no resources from a mobile device, so the batery power is saved contrary to period requests from client to a server, which would drain device battery quickly.

More technical details

I will provide more technical details in case somebody is interested about them. Actually the source code is publicly provided in a github, so feel free to ask if you have any questions about the project.

The project had some interesting challenges, related to the muti-threaded nature in the server implementation. At the start 7 Go routines are started.

Then each client driver or passenger, after connecting to the server is registered in the server with two new Go routines.

Also there is one api endpoint for passenger to get these initial drivers list.

The specific, related to the WebSockets is that when server receives message from any client, server decides what messagge and where to send it: to the same client, or to another client; and the message may be not obviously related to the received message before.

For this specific system the event-driven architecture matches well.

Future plans

Main plan is to implement Geocoding functionality; other not important now.