Originally published at aharshit123456.space .
A student with a scooter is about to leave the hostel gate. Another student wants to get to the library, which is on the way. The app has a few seconds to notice, propose the pair, let both sides agree, and then show the co-pilot a moving dot as the pilot approaches. Two things must never happen along the way: one pilot promised to two people, and one slow phone freezing the live view for everyone else. This post is about how the Go backend of Kurukuru does live matching, scheduled matching for repeat commutes, and the WebSocket hub that streams a trip, and about the concurrency bugs each of them taught me.
Kurukuru is a gamified, college-first, peer-to-peer ride-sharing app I built at CosQ. A pilot is already going somewhere with a free seat; a co-pilot needs a ride and pays the pilot in in-app coins. The co-pilot gets on at a Kuru in point and off at a Kuru out point along the pilot's route.…