I aim to create a website that showcases an interactive map populated with markers derived from data produced by a C++ function running on the server side. While I am aware that Java Server Pages can invoke Java methods through JavaScript, I would like to know if there is a parallel method for linking server-side C++ logic with client-side JavaScript. How might this integration be achieved to yield results comparable to those obtained with Java Server Pages?
hey sum1, im curious if using websockets to tie in c++ functions might yield even smoother interactivity on the fly? has anyone explored boosting performance with async c++ calls? any stories or challenges along the way?
Server-side C++ logic can interface with client-side JavaScript by exposing the functionality via HTTP APIs. In previous projects, I wrapped the critical C++ components into a RESTful service, which provided endpoints for the client to call asynchronously. The C++ code runs independently and returns JSON results that JavaScript can use to update the map dynamically. This approach mirrors the interactivity achieved with Java Server Pages, while keeping the server and client clearly separated, ensuring an efficient and maintainable design.
i built a node addon using ffi to directly call c++ functions in js. works decently for realtime maps updates. not as out of the box as a rest api but can be real slick if u manage memory correctly.