Bug #4825
Rider side not receiving location updates during trips
0%
Description
Particularly the problem of the rider side not receiving location updates during trips. Upon detailed analysis, We found that the root cause lies in the socket library currently used in our app.
We are using the SocketCluster library (io.github.sac:SocketclusterClientJava), which is outdated and not officially suitable for real-time location updates. Below are some recurring issues associated with this library:
Missing messages without any errors or disconnect indications.
Improper subscription timing or loss of connection state.
Inconsistent acknowledgements when multiple clients are subscribed to the same channel.
Socket not reconnecting properly despite showing as connected.
Failures due to Android clients being in background or Doze mode (affected by battery optimization settings).
While reviewing our implementation, I also found several code-level issues that may be compounding the problem:
Multiple subscriptions to the same channel are made repeatedly with each incoming location update.
Concurrent asynchronous subscriptions to different channels can lead to failure in message listening without triggering socket errors.
Channels are being disconnected right after the trip is accepted, even when some channels are still in a subscribed state.
Reconnection may sometimes fail, and even after reconnection, subscription and onMessage handling do not always work correctly.
Message acknowledgment failures occur occasionally, preventing reliable communication.
Updated by Sreedevi K S 11 months ago
- Status changed from New to In Progress
- Branch name set to sprint-19_sreedevi_4825
Updated by Sreedevi K S 11 months ago
- Status changed from In Progress to Resolved
I have resolved the bug and implemented the following fixes:
1. Implemented reconnection logic if the client is not connected at the time of a location update.
2. Ensured that each channel is subscribed only once by restricting repeated subscriptions to the same channel.
3. Resolved the issue where the socket disconnects immediately after the cab request is accepted, even though the channels are in a subscribed state. Also handled disconnection scenarios specifically during trip location updates.
4. Addressed the issue where the socket becomes inactive or unresponsive when the device is in an inactive state. The socket is now reactivated automatically when a cab request is accepted.
Note: There is still a delay of around 10–50 seconds in receiving location updates. Locations are received in bulk after some idle time. This delay is handled internally within the SocketCluster code and is not related to our app implementation.