Real-Time Bus Arrival Time Estimation API using WebSocket in Microservices Architecture

Kristian Adi Nugraha


In almost all countries, public transportation is the primary choice for people to make daily trips. One of the main problems of public transportation is the accuracy of the vehicle arrival schedule information. In some types of public transportation with particular tracks, such as rapid transit (e.g., MRT), the arrival time can be predicted easily because traffic jams do not affect transportation. This is different from buses, which use the same route as other vehicles so that traffic jams could affect them. This study tries to solve this problem by building an API that can be used to get information on the estimated arrival time of the bus. Estimated time is calculated based on the condition of the bus position and the actual condition of highway traffic from Google Directions API. The API was built using microservices technology, so it can be done quickly if it is further developed to a larger scale. The test was conducted on the Trans Jogja Bus by taking two routes, the short and the long routes. Each route could be explored 20 times under varying time and traffic conditions. Then, the difference between the estimated bus arrival time and the actual bus arrival time could be calculated on each trip. Based on the test results, the estimated bus arrival time generated by the API can be said to be entirely accurate because the difference between the estimated time and the actual bus arrival time is less than 30 seconds.


API; microservices; software architecture; bus arrival time; WebSocket

Full Text:



S. O'Dea, "Smartphone users worldwide 2016-2021," Statista, 10 December 2010. [Online]. Available:,in%20the%20next%20few%20years.. [Accessed 12 February 2021].

B. Yu, W. H. K. Lam and M. L. Tam, "Bus arrival time prediction at bus stop with multiple routes," Transportation Research Part C: Emerging Technologies, vol. 19, no. 6, pp. 1157-1170, 2011.

R. Hassan, H. I. A. Jabar, M. K. Hasan, M. C. Lam and W. M. H. W. Hussain, "Cloud Based Performance Data Analysis and Monitoring System for Express Bus in Malaysia," International Journal on Advanced Science, Engineering and Information Technology, vol. 9, no. 6, pp. 1959-1967, 2019.

Z. Y. Xie, Y. R. He, C. C. Chen, Q. Q. Li and C. C. Wu, "Multistep Prediction of Bus Arrival Time with the Recurrent Neural Network," Mathematical Problems of Applied System Innovations for IoT Applications, vol. 2021, 2021.

Q. Han, K. Liu, L. Zeng, G. He, L. Ye and F. Li, "A Bus Arrival Time Prediction Method Based on Position Calibration and LSTM," IEEE Access, vol. 8, pp. 42372 - 42383, 2020.

D. Sebastian, Restyandito and K. A. Nugraha, "Developing of Middleware and Cross Platform Chat Application," International Journal of Advanced Computer Science and Applications, vol. 12, no. 11, pp. 79-85, 2021.

V. A. Wardhany, H. Yuliandoko, Subono, M. U. H. A and I. G. P. Astawa, "Smart System and Monitoring of Vanammei Shrimp Ponds," International Journal on Advanced Science, Engineering and Information Technology, vol. 11, no. 4, pp. 1366-1372, 2021.

S. Wang, Y. Guo, N. Zhang, P. Yang, A. Zhou and X. Shen, "Delay-Aware Microservice Coordination in Mobile Edge Computing: A Reinforcement Learning Approach," IEEE Transactions on Mobile Computing, vol. 20, no. 3, pp. 939 - 951, 2021.

Y. Y. F. Panduman, M. R. U. Albaab, A. R. A. Besari, S. Sukaridhoto, A. Tjahjono and R. P. N. Budiarti, "Implementation of Data Abstraction Layer Using Kafka on SEMAR Platform for Air Quality Monitoring," International Journal on Advanced Science, Engineering and Information Technology, vol. 9, no. 5, pp. 1520-1527, 2019.

M. G. Son, K. S. Park and Y. H. Kong, "An Improvement of Hospital Reception System using Web Socket," Journal of the Korea Society of Computer and Information, vol. 20, no. 1, pp. 185-195, 2015.

J. Zhang, H. Jiang, Z. Ren, T. Zhang and Z. Huang, "Enriching API Documentation with Code Samples and Usage Scenarios from Crowd Knowledge," IEEE Transactions on Software Engineering, vol. 47, no. 6, pp. 1299 - 1314, 2019.

Y. Zhou, C. Wang, X. Yan, T. Chen, S. Panichella and H. Gall, "Automatic Detection and Repair Recommendation of Directive Defects in Java API Documentation," IEEE Transactions on Software Engineering, vol. 46, no. 9, pp. 1004 - 1023, 2020.

C. Chen, Z. Xing, Y. Liu and K. O. L. Xiong, "Mining Likely Analogical APIs Across Third-Party Libraries via Large-Scale Unsupervised API Semantics Embedding," IEEE Transactions on Software Engineering, vol. 47, no. 3, pp. 432 - 447, 2021.

L. Qi, Q. He, F. Chen, X. Zhang, W. Dou and Q. Ni, "Data-Driven Web APIs Recommendation for Building Web Applications," IEEE Transactions on Big Data, vol. 8, no. 3, pp. 685 - 698, 2022.

L. Li, W. Chou, W. Zhou and M. Luo, "Design Patterns and Extensibility of REST API for Networking Applications," IEEE Transactions on Network and Service Management , vol. 13, no. 1, pp. 154 - 167, 2016.

X. Wang, Q. Sun and J. Liang, "JSON-LD Based Web API Semantic Annotation Considering Distributed Knowledge," IEEE Access , vol. 8, pp. 197203 - 197221, 2020.

L. Shen, M. Pan, L. Liu, D. You, F. Li and Z. Chen, "Contexts Enhance Accuracy: On Modeling Context Aware Deep Factorization Machine for Web API QoS Prediction," IEEE Access, vol. 8, pp. 165551 - 165569, 2020.

J. M. Z. Mohd Hariz Naim, K. A. Jalil and L. Salahuddin, "Segmented Network Architecture for Promoting High Availability in Fog Computing through Middleware," International Journal on Advanced Science, Engineering and Information Technology, vol. 11, no. 6, pp. 2509-2517, 2021.

M. Lamothe, W. Shang and T.-H. P. Chen, "A3: Assisting Android API Migrations Using Code Examples," IEEE Transactions on Software Engineering , vol. 48, no. 2, pp. 417 - 431, 2020.

W. Rafique, X. Zhao, S. Yu, I. Yaqoob, M. Imran and N. U. N. C. Wanchun Dou Department of Computer Science and Technology and the State Key Laboratory for Novel Software Technology, "An Application Development Framework for Internet-of-Things Service Orchestration," IEEE Internet of Things Journal, vol. 7, no. 5, pp. 4543 - 4556, 2020.

A. Neumann, N. Laranjeiro and J. Bernardino, "An Analysis of Public REST Web Service APIs," IEEE Transactions on Services Computing, vol. 14, no. 4, pp. 957 - 970, 2021.

G. Vega-Gorgojo, "CRAFTS: Configurable REST APIs for Triple Stores," IEEE Access , vol. 10, pp. 32426 - 32441, 2022.

L. Jiang, H. Liu, H. Jiang, L. Zhang and H. Mei, "Heuristic and Neural Network Based Prediction of Project-Specific API Member Access," IEEE Transactions on Software Engineering, vol. 48, pp. 1249 - 1267, 2022.

N. Laranjeiro, J. Agnelo and J. Bernardino, "A Black Box Tool for Robustness Testing of REST Services," IEEE Access, vol. 9, pp. 24738 - 24754, 2021.

Y. Go, H. Noh, G. Park and H. Song, "Hybrid TCP/UDP-Based Enhanced HTTP Adaptive Streaming System With Multi-Homed Mobile Terminal," IEEE Transactions on Vehicular Technology, vol. 68, no. 5, pp. 5114 - 5128, 2019.

Q. Liu and X. Sun, "Research of Web Real-Time Communication Based on Web Socket," International Journal of Communications, Network and System Sciences, vol. 5, no. 12, pp. 797-801, 2012.

C. U. o. P. a. T. C. C. Wenbo Mei School of Computer Science and Technology and Z. Long, "Research and Defense of Cross-Site WebSocket Hijacking Vulnerability," in 2020 IEEE International Conference on Artificial Intelligence and Computer Applications (ICAICA), Dalian, China, 2020.

B. C. Li and S. Z. Yu, "Keyword Mining for Private Protocols Tunneled Over WebSocket," IEEE Communications Letters, vol. 20, no. 7, pp. 1337 - 1340, 2016.

C. Pintavirooj, T. Keatsamarn and T. Treebupachatsakul, "Multi-Parameter Vital Sign Telemedicine System Using Web Socket for COVID19 Pandemics," Healthcare, vol. 9, no. 3, 2021.

H. Calderón-Gómez, L. Mendoza-Pittí, M. Vargas-Lombardo, J. M. Gómez-Pulido and J. Luis, "Telemonitoring System for Infectious Disease Prediction in Elderly People Based on a Novel Microservice Architecture," IEEE Access, vol. 8, pp. 118340 - 118354, 2020.

N. C. Coulson, S. Sotiriadis and N. Bessis, "Adaptive Microservice Scaling for Elastic Applications," IEEE Internet of Things Journal, vol. 7, no. 5, pp. 4195 - 4202, 2020.

A. Ali and M. M. Iqbal, "A Cost and Energy Efficient Task Scheduling Technique to Offload Microservices Based Applications in Mobile Cloud Computing," IEEE Access, vol. 10, pp. 46633 - 46651, 2022.

Y. Liang and Y. Lan, "TCLBM: A task chain-based load balancing algorithm for microservices," Tsinghua Science and Technology , vol. 26, no. 3, pp. 251 - 258, 2021.

K. Fu, W. Zhang, Q. Chen, D. Zeng and M. Guo, "Adaptive Resource Efficient Microservice Deployment in Cloud-Edge Continuum," IEEE Transactions on Parallel and Distributed Systems, vol. 33, no. 8, pp. 1825 - 1840, 2022.

W. Lv, Q. Wang, P. Yang, Y. Ding, B. Yi, Z. Wang and C. Lin, "Microservice Deployment in Edge Computing Based on Deep Q Learning," IEEE Transactions on Parallel and Distributed Systems , vol. 33, no. 11, pp. 2968 - 2978, 2022.

I. K. Aksakalli, T. Celik, A. B. Can and B. Tekinerdogan, "Systematic Approach for Generation of Feasible Deployment Alternatives for Microservices Publisher: IEEE Cite This PDF," IEEE Access , vol. 9, pp. 29505 - 29529, 2021.

G. Blinowski, A. Ojdowska and A. Przybyłek, "Monolithic vs. Microservice Architecture: A Performance and Scalability Evaluation," IEEE Access, vol. 10, pp. 20357 - 20374, 2022.

C. Richardson, "Pattern: Microservice Architecture,", 2021. [Online]. Available: [Accessed 30 November 2021].

Rianto, M. A. Rifansyah, R. Gunawan, I. Darmawan and A. Rahmatulloh, "Comparison of JSON and XML Data Formats in Document Stored NoSql Database Replication Processes," International Journal on Advanced Science, Engineering and Information Technology, vol. 11, no. 3, pp. 1150-1156, 2021.



  • There are currently no refbacks.

Published by INSIGHT - Indonesian Society for Knowledge and Human Development