# Driver Matching Flow

From v1.6.5 we have added a new driver assignment flow. Previously driver assignment is done through the backend and data from firebase.

In the v1.6.5, we introduce a new flow for the driver assignment, wehere data is push to firebase and to driver device for matching to be done on driver device.

You can toggle between with of the driver matching flow to use:

1. Old
2. New
3. Firebase clound function

You can make this changes from the backend

<figure><img src="https://2231621966-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MVNlKuUeCM_uD7sLQnM%2Fuploads%2FsY4pRgWl78dMPui63pfH%2Fimage.png?alt=media&#x26;token=f5a70dfc-95e0-4e70-bd42-e11b46e7f4cc" alt=""><figcaption></figcaption></figure>

From v1.6.5 there is 2 options for the driver assignment system. Both has their Pros & Cons

### Old Flow

This is the previous auto-assignment flow. The driver app sends driver location at a interval to the firebase and there there is an order ready to be assigned. The backend server fetch the list of drivers within the order pickup location(Taxi order)/vendor address(regular order) and send the order via notification to the filtered drivers and the driver get a New order alert on their devices

#### Pros

1. Fastly
2. Easy handle of new orders as it comes in

#### Cons

1. Not fully reliable as the driver location to pickup location is measture linearly
2. Sometimes New order order doesn't get to the driver app

### New Flow

This new flow, move the assignment system to the driver app itself.&#x20;

When there is a new order, the backend server will puch the order to a firebase firestore node.&#x20;

Then the driver within the location with load the database from firebase and the first driver app to notify the system after getting the order will be allowed to show the New Order alert.

If the driver ignore the order, then the other drivers will get to chance to notify server of showing the order to driver.

#### Pros

1. Reliable, at least a driver within the range will always get the notification
2. Will work even in background state

#### Cons

1. There is constant check from the driver app to be the first to get order
2. Firebase data reading/api calls are more then the old flow


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://edentech.gitbook.io/glover/how-to/driver-matching-flow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
