Sunday, 4 June 2017

Sent request to nearby driver using settimeout in Nodejs?

Here is the whole scenario of what I want

Send request to Drivers 1 by 1

There are 4 drivers in a 5 km Radius. Customer will request a ride and request will be sent to nearest driver first then after (requestTime/2) ms request will be shifted to the next nearest driver, if during request any driver accept the ride, then ride request will stop and will not be sent to other drivers.

Note:

  • a single request will be sent to all the drivers with same session, mean request will be generated once from the client side. If after request sent no matter if client refresh its browser he will get the response when driver accept the request.
  • we can have each driver in single window with single link (endpoints), i.e

192.168.1.1/ACustomer_requestRide (client can send a request by checking how many driver available near to him)

192.168.1.1/ADriver_connect (for driver connect and available in user request area)

192.168.1.1/BDriver_connect (for driver connect and available in user request area)

all will connect like that then will receive request in the respective browser 1 by 1.



via DEO

No comments:

Post a Comment